This is a note to let you know that I've just added the patch titled nvme: core: don't hold rcu read lock in nvme_ns_chr_uring_cmd_iopoll to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: nvme-core-don-t-hold-rcu-read-lock-in-nvme_ns_chr_ur.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit d01f4cee237b3a0cba25055f9e083a53ec71afcd Author: Ming Lei <ming.lei@xxxxxxxxxx> Date: Wed Aug 9 10:04:40 2023 +0800 nvme: core: don't hold rcu read lock in nvme_ns_chr_uring_cmd_iopoll [ Upstream commit a7a7dabb5dd72d2875bc3ce56f94ea5ceb259d5b ] 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: 585079b6e425 ("nvme: wire up async polling for io passthrough commands") Reported-by: Guangwu Zhang <guazhang@xxxxxxxxxx> Cc: Kanchan Joshi <joshi.k@xxxxxxxxxxx> Cc: Anuj Gupta <anuj20.g@xxxxxxxxxxx> Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> Tested-by: Guangwu Zhang <guazhang@xxxxxxxxxx> Link: https://lore.kernel.org/r/20230809020440.174682-1-ming.lei@xxxxxxxxxx Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c index 8224675f8de25..ac7d61ce30108 100644 --- a/drivers/nvme/host/ioctl.c +++ b/drivers/nvme/host/ioctl.c @@ -706,14 +706,12 @@ int nvme_ns_chr_uring_cmd_iopoll(struct io_uring_cmd *ioucmd, struct nvme_ns *ns; struct request_queue *q; - rcu_read_lock(); bio = READ_ONCE(ioucmd->cookie); ns = container_of(file_inode(ioucmd->file)->i_cdev, struct nvme_ns, cdev); q = ns->queue; if (test_bit(QUEUE_FLAG_POLL, &q->queue_flags) && bio && bio->bi_bdev) ret = bio_poll(bio, iob, poll_flags); - rcu_read_unlock(); return ret; } #ifdef CONFIG_NVME_MULTIPATH