From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796221473; b=IYUmWMEgnC5Hou3OXzTzUZ4DLcJ1OlvCSo2IqlYS+6xKGFV1Wn/OLqpU54piSGrcF+5M R91MQLXL80/nbjxZD3NlvPn0aJPN1FoZezyV0IghzVQH6km+kWPuG2ln04Cp7J2VUl33w 9r6dh50z58IF7sP5JVmTRE79V6PF9qHCxZghJkC+uhottOZWiribaUPNzrSkgbTVmFLfv pO1Z1+q6uNheigoxQaxdKXV527+FK1RE81uhWCePzN8iyxYnOnUc4/eggmLbQzhut5CCP 7GV5NYteJicbjvGbt6ZaFj6K7LJfvDsatsBhGcLEWw+Wu6CjQ3FmBDFbN9FA6HdwLMA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221473; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=1FiKoqDGMNgGvegQhQ3RzEHbHol4YH622IWcAv79iXE=; b=UbM4lRKIVGrmZjkuNV4dbFWCm+foiX8a80KV29vdpaqxMPNQb3ETku0A4dMGLzXLXX8N b5SoMqxQwMkeP0pSfHkrtWSLYCoOusFS6fJ7xXOqIXHzKd/9G2yOYx92PiElcihHVufiH BvILKqxT7QC5rZUvm8TL8WdDb7N8DIXkgIzCvj/4YeECVKQCIJYX2eOxjFcYWRWH8huLC SxmLj2R/Ydkrki71DxA+F1wRV8v6zvXCIEgZKUfSjk2afhgF7otjBuxtPlRZHvfWDE5+E OUFLaIEm6YomUjQIL6K58OtAUxhlk7iAxHsk4EnZe9jhV3h0jQHpP1snilDxvekBsdQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=w7Lm3cdP; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 647EF606A31A for ; Wed, 2 Dec 2026 14:24:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=w7Lm3cdP Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4FCB1F00893; Wed, 2 Dec 2026 14:24:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221473; bh=1FiKoqDGMNgGvegQhQ3RzEHbHol4YH622IWcAv79iXE=; h=Subject:To:Cc:From:Date; b=w7Lm3cdPK3LmC+9mZXu2axeTNfviqzF9/Kmbyl0IV3Mp/yu6Y0NgdLDobNrMRhpwq D7dPIspFjZBTV6yqOZPxsxm/wBwf7kzBXrO9rPxBxyG4U/zw3u4IO2kVFeyDmweCVA EiqPDHiXcSCXRYcyt4pKr17odc4QxEZCS2UZduLg= Subject: FAILED: patch "[PATCH] nvme: stop asynchronous event work before ANA teardown" failed to apply to 6.1-stable tree To: shunsheng1218@gmail.com,hch@lst.de,kbusch@kernel.org Cc: From: Date: Wed, 02 Dec 2026 14:51:51 +0100 Message-ID: <2026120251-paramedic-gauntlet-fe36@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit 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 9b657c565984f28976b1e471e3ce2f81cc269238 # git commit -s git send-email --to '' --in-reply-to '2026120251-paramedic-gauntlet-fe36@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 9b657c565984f28976b1e471e3ce2f81cc269238 Mon Sep 17 00:00:00 2001 From: Yaohan Li Date: Thu, 5 Nov 2026 19:41:49 +0800 Subject: [PATCH] nvme: stop asynchronous event work before ANA teardown NVMe ANA work has several producers, including ANA AER completion, namespace scanning and failover processing. An AER completion can queue ana_work for an ANA notice and can separately queue async_event_work, which sends the AEN uevent and submits the next asynchronous event request. These work items access controller-owned state during asynchronous processing. This issue was investigated and the fix was developed with AI assistance (ZCode/GLM-4). Fixes: 0d0b660f214dc ("nvme: add ANA support") Cc: stable@vger.kernel.org Signed-off-by: Yaohan Li Reviewed-by: Christoph Hellwig Signed-off-by: Keith Busch diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index ed44d7882dd4..cd0df9b03806 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -5198,6 +5198,15 @@ EXPORT_SYMBOL_GPL(nvme_start_ctrl); void nvme_uninit_ctrl(struct nvme_ctrl *ctrl) { nvme_stop_keep_alive(ctrl); + + /* + * An AER completion can queue async_event_work; drain it before the + * controller's final release. Note that ana_work has additional + * producers (namespace scanning via nvme_scan_work, and the failover + * path in nvme_failover_req), which is why nvme_mpath_uninit() + * separately cancels ana_work after this point. + */ + cancel_work_sync(&ctrl->async_event_work); nvme_hwmon_exit(ctrl); nvme_fault_inject_fini(&ctrl->fault_inject); dev_pm_qos_hide_latency_tolerance(ctrl->device); diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index ae8059366b57..27facdbb3d4c 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -1608,6 +1608,13 @@ int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) void nvme_mpath_uninit(struct nvme_ctrl *ctrl) { + /* + * ANA work can be queued by nvme_handle_aen_notice, nvme_scan_work, + * and nvme_failover_req. Drain remaining work before releasing the ANA + * resources. + */ + cancel_work_sync(&ctrl->ana_work); + kvfree(ctrl->ana_log_buf); ctrl->ana_log_buf = NULL; ctrl->ana_log_size = 0;