From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E204C0015E for ; Sat, 12 Aug 2023 17:57:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229497AbjHLR5X (ORCPT ); Sat, 12 Aug 2023 13:57:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbjHLR5X (ORCPT ); Sat, 12 Aug 2023 13:57:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A67610E5 for ; Sat, 12 Aug 2023 10:57:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1068361D2B for ; Sat, 12 Aug 2023 17:57:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FF4CC433C7; Sat, 12 Aug 2023 17:57:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1691863045; bh=vUhc11PA/cfWlvqfMX+idE47Lf+A8FR+DfPZAoppdXE=; h=Subject:To:Cc:From:Date:From; b=Czq2rlZP89yl3L7+vzGZWwMTbD74wfzuuamujWKWkq5CNtRx8nriFyO9Dh9OkcW6l tuuTgHrww/QS+GFW4H9phHYcAy8VutpT/F00SZT4Y6h828LszkFxR32ApjpG8VDtOU BcC/tOzNwg+S5fC7uuAN0AjPBXM5ZxDgeFNPmTlg= Subject: FAILED: patch "[PATCH] nvme: core: don't hold rcu read lock in" failed to apply to 6.1-stable tree To: ming.lei@redhat.com, anuj20.g@samsung.com, axboe@kernel.dk, guazhang@redhat.com, joshi.k@samsung.com Cc: From: Date: Sat, 12 Aug 2023 19:57:14 +0200 Message-ID: <2023081214-profane-president-bf35@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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 . 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 # git commit -s git send-email --to '' --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 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") Reported-by: Guangwu Zhang Cc: Kanchan Joshi Cc: Anuj Gupta Signed-off-by: Ming Lei Tested-by: Guangwu Zhang Link: https://lore.kernel.org/r/20230809020440.174682-1-ming.lei@redhat.com Signed-off-by: Jens Axboe diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c index 5c3250f36ce7..d39f3219358b 100644 --- a/drivers/nvme/host/ioctl.c +++ b/drivers/nvme/host/ioctl.c @@ -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