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=1796383985; b=Hen7CDlK3wHiZCwxZqUa/GFvkGR8hRI4Z3y8U5RDfWPSxzN0i/qJvlz5zpBlRzUinxSQ hG8AWVKViFa5wLk8+VW7HVDKv07kzdp3HVENl31UnMqC+SDQ83IxezKyEsXoxcfBYLAC8 /lSwvsDZT8+oSiuRkYeMyPrRc4BmxGp5lPFJRiQNHQrEZpbdgFJHB+ygDj0l3MiZ1lx8I wUk6Y7P3S9UCubL45S7bGTY/jSbviBKnCrJfQQfBWbROfPmcjwLTIyDbYT4PAUkyJ/hAQ djcfkHBfvpP0tetoV0HwNW5QN9hWJTmWR/aSO8ia6RIbWiUBA9TxnS/7nZ1JgiDBWuA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383985; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=4Ou/MtLivs/D5kuTgzz7jIAykRq3a4PIjM8AgSDN1KY=; b=3rzk/+01yDeABgAslYCDTYg58EFxKXQX6QVXPxcxuT5AW3B43hoJ1b9ZI8x6fvoJpbGc 6BneHTE8lUSCEG7snT3OniejwpA3VeQQXzwRAkxoPv5Cdmm7fzgLQba11NxryphVxndDv kGRdUjR+XhFPOoSAm2rNK2XqiN8aCphmOXFPH4T4IETLFTI6Xqn9MwEZQ8FfTjoea+4Rq 0q1Fb8MNz9WGzr0w+rb/n1taygP9eZW8ff4GW7WP6GGEGCQN2xy4lp1kLHiXCA76Q/qY3 7YAJmFV1D5ZWS81weT6lwMTrlqYCFH5UW7yS9jolYtdTNQsaRsph8zoD50IebDPRZHA== 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=rV3Ivc2I; 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 27E20606A336; Fri, 4 Dec 2026 11:33:05 +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=rV3Ivc2I Received: by smtp.kernel.org (Postfix) with ESMTPSA id 905E51F000C2; Fri, 4 Dec 2026 11:33:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383985; bh=4Ou/MtLivs/D5kuTgzz7jIAykRq3a4PIjM8AgSDN1KY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rV3Ivc2Ins0Hne1Hh9h7z9Ei7XlHX8KfxOdI+XCO7vh2EOH8T9eiciEEXQj6IlNva rVVNBeMBXv7afCoVq//HTDdloConX2lavCWy/cODIK5EJ/3qrN1mbyleYBmm5amr13 dV5ORO7g3DWGTxxTHpSE6JnsojCwJ6tiBtoGwBeg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Cen Zhang , Andrew Morton , Joseph Qi , Mark Fasheh , Joel Becker , Heming Zhao , Jia-Ju Bai , jjzuming@gmail.com Subject: [PATCH 6.12 446/555] ocfs2/dlmfs: keep the superblock alive during lock work Date: Fri, 4 Dec 2026 19:08:09 +0900 Message-ID: <20261204100626.493727767@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore 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-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Cen Zhang commit e9e66aa5ef1a76ec92fe41c5eb16fda7a39db279 upstream. Queued dlmfs lock work holds an inode reference, but no active reference to its superblock. The workqueue is drained on module exit rather than on each dlmfs unmount, and an inode reference does not stop superblock shutdown: generic_shutdown_super() reports the busy inode and goes on. DLM callback / worker Unmount --------------------- ------- queue lock work; igrab(inode) worker delayed drop last active superblock ref kill_anon_super() report the busy inode free the superblock finish lock work iput(inode) access the inode's freed superblock Flushing the workqueue from a dlmfs kill_sb would not be enough: a blocking AST can queue new work for an inode that is still alive after the flush and before eviction, and that work again holds only an inode reference. Take an active superblock reference before acquiring the queued inode reference, with the atomic_inc_not_zero() on s_active that grab_super() and the NFS and procfs superblock walkers use. Decline to queue if the superblock is already shutting down; the inode is then being evicted and user_dlm_destroy_lock() tears the lock down. The existing l_lock and USER_LOCK_QUEUED flag serialize this with other queue attempts. Each execution drops its inode reference before releasing the active superblock reference, outside l_lock. If that releases the last active reference, the unmount completes on the worker; it only waits for DLM replies and never for this workqueue. Only the relevant frames of the report are kept: Oops: general protection fault, probably for non-canonical address 0xfbd59c0000000026: 0000 [#1] SMP KASAN NOPTI KASAN: maybe wild-memory-access in range [0xdead000000000130-0xdead000000000137] Workqueue: user_dlm user_dlm_unblock_lock RIP: 0010:iput+0x246/0xc10 Call Trace: user_dlm_unblock_lock+0x503/0xa50 process_one_work+0x9a8/0x1b40 worker_thread+0x65c/0xe40 Link: https://lore.kernel.org/pm-ocfs2-objects-candidate-0054-v6-c3887cceae3b039e591e@gmail.com Fixes: 8df08c89c668 ("[PATCH] OCFS2: The Second Oracle Cluster Filesystem") Signed-off-by: Cen Zhang Signed-off-by: Andrew Morton Reviewed-by: Joseph Qi Cc: Mark Fasheh Cc: Joel Becker Cc: Heming Zhao Cc: Jia-Ju Bai Cc: Cc: Signed-off-by: Greg Kroah-Hartman fs/ocfs2/dlmfs/userdlm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) --- fs/ocfs2/dlmfs/userdlm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) --- a/fs/ocfs2/dlmfs/userdlm.c +++ b/fs/ocfs2/dlmfs/userdlm.c @@ -162,7 +162,13 @@ static void user_dlm_unblock_lock(struct static void __user_dlm_queue_lockres(struct user_lock_res *lockres) { + struct inode *inode = user_dlm_inode_from_user_lockres(lockres); + if (!(lockres->l_flags & USER_LOCK_QUEUED)) { + /* Pin the superblock through the worker's iput(). */ + if (!atomic_inc_not_zero(&inode->i_sb->s_active)) + return; + user_dlm_grab_inode_ref(lockres); INIT_WORK(&lockres->l_work, user_dlm_unblock_lock); @@ -275,9 +281,11 @@ static struct ocfs2_locking_protocol use static inline void user_dlm_drop_inode_ref(struct user_lock_res *lockres) { - struct inode *inode; - inode = user_dlm_inode_from_user_lockres(lockres); + struct inode *inode = user_dlm_inode_from_user_lockres(lockres); + struct super_block *sb = inode->i_sb; + iput(inode); + deactivate_super(sb); } static void user_dlm_unblock_lock(struct work_struct *work)