[PATCH 4/4] nvme: wire up async polling for io passthrough commands
Kanchan Joshi
joshi.k at samsung.com
Fri Aug 5 10:07:07 PDT 2022
On Fri, Aug 05, 2022 at 11:03:55AM -0600, Jens Axboe wrote:
>On 8/5/22 9:42 AM, Kanchan Joshi wrote:
>> @@ -685,6 +721,29 @@ int nvme_ns_head_chr_uring_cmd(struct io_uring_cmd *ioucmd,
>> srcu_read_unlock(&head->srcu, srcu_idx);
>> return ret;
>> }
>> +
>> +int nvme_ns_head_chr_uring_cmd_iopoll(struct io_uring_cmd *ioucmd)
>> +{
>> + struct cdev *cdev = file_inode(ioucmd->file)->i_cdev;
>> + struct nvme_ns_head *head = container_of(cdev, struct nvme_ns_head, cdev);
>> + int srcu_idx = srcu_read_lock(&head->srcu);
>> + struct nvme_ns *ns = nvme_find_path(head);
>> + struct bio *bio;
>> + int ret = 0;
>> + struct request_queue *q;
>> +
>> + if (ns) {
>> + rcu_read_lock();
>> + bio = READ_ONCE(ioucmd->private);
>> + q = ns->queue;
>> + if (test_bit(QUEUE_FLAG_POLL, &q->queue_flags) && bio
>> + && bio->bi_bdev)
>> + ret = bio_poll(bio, 0, 0);
>> + rcu_read_unlock();
>> + }
>> + srcu_read_unlock(&head->srcu, srcu_idx);
>> + return ret;
>> +}
>> #endif /* CONFIG_NVME_MULTIPATH */
>
>Looks like that READ_ONCE() should be:
>
> bio = READ_ONCE(ioucmd->cookie);
>
>?
Damn, indeed. Would have caught if I had compiled this with
NVME_MULTIPATH config enabled. Thanks for the catch.
More information about the Linux-nvme
mailing list