Skip to contentSkip to conversation

FAILED: patch "[PATCH] nvme: core: don't hold rcu read lock in" failed to apply to 6.1-stable tree

PATCH [email protected] 1 participant 1 message Aug 12, 2023

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x a7a7dabb5dd72d2875bc3ce56f94ea5ceb259d5b
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023081214-profane-president-bf35@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..

Possible dependencies:

a7a7dabb5dd7 ("nvme: core: don't hold rcu read lock in nvme_ns_chr_uring_cmd_iopoll") 9408d8a37e6c ("nvme: improved uring polling")
f026be0e1e88 ("nvme: optimise io_uring passthrough completion") 9d2789ac9d60 ("block/io_uring: pass in issue_flags for uring_cmd task_work handling") b2cf789f6cb6 ("Merge branch 'for-6.2/io_uring' into for-6.2/io_uring-next")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From a7a7dabb5dd72d2875bc3ce56f94ea5ceb259d5b Mon Sep 17 00:00:00 2001
From: Ming Lei <[email protected]>
Date: Wed, 9 Aug 2023 10:04:40 +0800
Subject: [PATCH] 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 585079b6e425 ("nvme: wire up async polling for io passthrough commands")
Cc Kanchan Joshi <[email protected]>
Cc Anuj Gupta <[email protected]>
drivers/nvme/host/ioctl.c +0 -2
index 5c3250f36ce7..d39f3219358b 100644
@@ -786,11 +786,9 @@ int nvme_ns_chr_uring_cmd_iopoll(struct io_uring_cmd *ioucmd,
 	if (!(ioucmd->flags & IORING_URING_CMD_POLLED))
 		return 0;
 
-	rcu_read_lock();
 	req = READ_ONCE(ioucmd->cookie);
 	if (req && blk_rq_is_poll(req))
 		ret = blk_rq_poll(req, iob, poll_flags);
-	rcu_read_unlock();
 	return ret;
 }
 #ifdef CONFIG_NVME_MULTIPATH