Skip to content

Commit a7a7dab

Browse files
Ming Leiaxboe
authored andcommitted
nvme: core: don't hold rcu read lock in nvme_ns_chr_uring_cmd_iopoll
Now nvme_ns_chr_uring_cmd_iopoll() has switched to request based io polling, and the associated NS is guaranteed to be live in case of io polling, so request is guaranteed to be valid because blk-mq uses pre-allocated request pool. Remove the rcu read lock in nvme_ns_chr_uring_cmd_iopoll(), which isn't needed any more after switching to request based io polling. Fix "BUG: sleeping function called from invalid context" because set_page_dirty_lock() from blk_rq_unmap_user() may sleep. Fixes: 585079b ("nvme: wire up async polling for io passthrough commands") Reported-by: Guangwu Zhang <[email protected]> Cc: Kanchan Joshi <[email protected]> Cc: Anuj Gupta <[email protected]> Signed-off-by: Ming Lei <[email protected]> Tested-by: Guangwu Zhang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent f099a10 commit a7a7dab

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

drivers/nvme/host/ioctl.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,11 +786,9 @@ int nvme_ns_chr_uring_cmd_iopoll(struct io_uring_cmd *ioucmd,
786786
if (!(ioucmd->flags & IORING_URING_CMD_POLLED))
787787
return 0;
788788

789-
rcu_read_lock();
790789
req = READ_ONCE(ioucmd->cookie);
791790
if (req && blk_rq_is_poll(req))
792791
ret = blk_rq_poll(req, iob, poll_flags);
793-
rcu_read_unlock();
794792
return ret;
795793
}
796794
#ifdef CONFIG_NVME_MULTIPATH

0 commit comments

Comments
 (0)