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=1794274034; b=M4ebchW9FoIQDjPZ6IRmYu0Ff87/6ZKz4n08ZD9cWawFjlnVnkd5PEeSxBP8t1sh/b7H IZXtqduUH7fNEP4lMp99XP5MI0zvDgCZBm+p0iJfsKCCwdaK3bnY7RIWQnLrJiNFRQKCh evyasHicKAXbTSjyfDDqn3gMtjK70Youp9wWGexOem9865i5IhN1pyUayBKXJkEv0BqzT VQjDddYcrlNgCYYOPgSC7Ku3cx3DjVNUMWOURPnloDKUIZcu4HhRZA99rYy5zCwvF6SPD vdjX+sH/kHULCGwUeyxEGpIK28WoMJXpkfeh3UVUDOlyWqboMnSkx365PH8dbBbxi6A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794274034; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=v0xYHwq7yE5STrH+7Bmm/hfKnLvmJKTTYsTcFiw106A=; b=fzuD5V7NuEVZTj6EWW1R86MPgmuAl/cgjXkbXavNrU0FNR+13Xln1R4o65azZARsXARB PJs74GqO39xldTesJ1hc6ewjNxhIkRZJYp2oOUvNnEa0DWVRo68CnP+GL6GQwiDKZAGsH agnj7vNFSmMYqkUBDSCt+CZ+vQ7wLPhKYUY7Hk9265CPgXCAg/TU3GhN9FVZFuQLQa/MQ GazoE/Be6lopNhYHhqI0BOPnKlss+dy6EoNavxxI57MmYXPOWp1OD5oddVjKcdbng9yfq mgtBZmgKBFMag8QHLSbr05o5OUbSUDNCeMs5WeG2myhImumsNiespP86u+nYE/y1pTA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=R+BfoX16; 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 2CDFF606A321 for ; Tue, 10 Nov 2026 01:27:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=R+BfoX16 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 074221F0089F; Tue, 10 Nov 2026 01:27:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794274034; bh=v0xYHwq7yE5STrH+7Bmm/hfKnLvmJKTTYsTcFiw106A=; h=From:To:Cc:Subject:Date; b=R+BfoX16vxAXqePepvQZ7+yYQynztOPa5KiEMXwnX9fS81iRVLgnIP6JMOuRSnXAd XNV8/eKnRSSZGmOxx54ojuXcVhe/UTSKreAlm1KrXx4uKDOHcDwdEXYxMHK18pY6pq MgtX9QGW6QZm3DbtBBFRBV1g8qxRLD25z9SFmUeBvrV7lwZXxNPgVjvxnPXyImbr6A OUnlite+FA/uaO2Zoe5CB//U0LHUp/43Pds+LzW0AE2mwMTyHTezodSfBsg19uUVEU sug+pPO/jrKFlHRIJz5DovNqwHBPxXn/eEEJ1/7/KLti8ZDeOCzY9aZZuUenEcClpR T37thl6T+W5Ig== From: Sasha Levin To: zzzccc427@gmail.com, akpm@linux-foundation.org, joseph.qi@linux.alibaba.com, mark@fasheh.com, jlbec@evilplan.org, heming.zhao@suse.com, baijiaju1990@gmail.com, jjzuming@gmail.com Cc: stable@vger.kernel.org Subject: FAILED: patch "[PATCH] ocfs2: cache the mount context for dentry lock callbacks" failed to apply to 5.10-stable tree Date: Mon, 9 Nov 2026 20:27:11 -0500 Message-ID: <20261109202711-failed-5.10-5b4696e0bfc3@kernel.org> X-Mailer: git-send-email 2.53.0 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=UTF-8 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.10-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-5.10.y git checkout FETCH_HEAD git cherry-pick -x 5b4696e0bfc358619adaeab25ad35b4979af8331 # git commit -s git send-email --to '' --in-reply-to '20261109202711-failed-5.10-5b4696e0bfc3@kernel.org' --subject-prefix 'PATCH 5.10.y' 'HEAD^..' Thanks, Sasha ------------------ original commit in Linus's tree ------------------ >From 5b4696e0bfc358619adaeab25ad35b4979af8331 Mon Sep 17 00:00:00 2001 From: Cen Zhang Date: Tue, 20 Oct 2026 22:25:53 +0800 Subject: [PATCH] ocfs2: cache the mount context for dentry lock callbacks ocfs2_drop_dentry_lock() drops the inode reference before releasing the DENTRY lock. This lets inode eviction release the local inode and open locks before a remote unlink can proceed past the DENTRY lock. A DLM callback can still arrive before the DENTRY lock has been dropped. ocfs2_get_dentry_osb() obtains the mount context through dl_inode->i_sb, which can access a freed inode when the downconvert thread drops the last inode reference in its post-unlock callback: Downconvert thread DLM callback thread ------------------ ------------------- ocfs2_process_blocked_lock() ocfs2_dentry_post_unlock() ocfs2_dentry_lock_put() ocfs2_drop_dentry_lock() iput(dl->dl_inode) [inode reclaimed after RCU] ocfs2_blocking_ast() ocfs2_get_dentry_osb() dl->dl_inode->i_sb ocfs2_simple_drop_lockres() Store the mount context in the DENTRY lock resource's l_priv field and use the default mount-context lookup. Recover the containing dentry lock with container_of(), as already done for refcount locks, and remove ocfs2_get_dentry_osb(). ocfs2_dismount_volume() shuts down the DLM before freeing the mount context, so callbacks can use it without accessing the inode. Preserve the existing iput-before-unlock order to avoid delaying local inode and open lock release until after the DENTRY lock is released. Link: https://lore.kernel.org/pm-ocfs2-objects-candidate-0012-v9-eeb9084fb29577971229@gmail.com Fixes: 8ed6b23709b3 ("ocfs2: revert iput deferring code in ocfs2_drop_dentry_lock") Signed-off-by: Cen Zhang Signed-off-by: Andrew Morton Suggested-by: Joseph Qi Reviewed-by: Joseph Qi Assisted-by: LLM Cc: Mark Fasheh Cc: Joel Becker Cc: Heming Zhao Cc: Jia-Ju Bai Cc: Cc: --- fs/ocfs2/dcache.h | 5 ++--- fs/ocfs2/dlmglue.c | 16 ++++------------ 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/fs/ocfs2/dcache.h b/fs/ocfs2/dcache.h index 7f246c5692d82..046ab9a807692 100644 --- a/fs/ocfs2/dcache.h +++ b/fs/ocfs2/dcache.h @@ -17,9 +17,8 @@ struct ocfs2_dentry_lock { u64 dl_parent_blkno; /* - * The ocfs2_dentry_lock keeps an inode reference until - * dl_lockres has been destroyed. This is usually done in - * ->d_iput() anyway, so there should be minimal impact. + * The inode reference is dropped before dl_lockres is unlocked. + * Callbacks must not use it to find the mount context during teardown. */ struct inode *dl_inode; struct ocfs2_lock_res dl_lockres; diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 412ab0808c59c..c281902e3bece 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c @@ -58,7 +58,6 @@ struct ocfs2_mask_waiter { #endif }; -static struct ocfs2_super *ocfs2_get_dentry_osb(struct ocfs2_lock_res *lockres); static struct ocfs2_super *ocfs2_get_inode_osb(struct ocfs2_lock_res *lockres); static struct ocfs2_super *ocfs2_get_file_osb(struct ocfs2_lock_res *lockres); static struct ocfs2_super *ocfs2_get_qinfo_osb(struct ocfs2_lock_res *lockres); @@ -258,7 +257,6 @@ static const struct ocfs2_lock_res_ops ocfs2_orphan_scan_lops = { }; static const struct ocfs2_lock_res_ops ocfs2_dentry_lops = { - .get_osb = ocfs2_get_dentry_osb, .post_unlock = ocfs2_dentry_post_unlock, .downconvert_worker = ocfs2_dentry_convert_worker, .flags = 0, @@ -309,7 +307,7 @@ static inline struct ocfs2_dentry_lock *ocfs2_lock_res_dl(struct ocfs2_lock_res { BUG_ON(lockres->l_type != OCFS2_LOCK_TYPE_DENTRY); - return (struct ocfs2_dentry_lock *)lockres->l_priv; + return container_of(lockres, struct ocfs2_dentry_lock, dl_lockres); } static inline struct ocfs2_mem_dqinfo *ocfs2_lock_res_qinfo(struct ocfs2_lock_res *lockres) @@ -610,13 +608,6 @@ static __u64 ocfs2_get_dentry_lock_ino(struct ocfs2_lock_res *lockres) return be64_to_cpu(inode_blkno_be); } -static struct ocfs2_super *ocfs2_get_dentry_osb(struct ocfs2_lock_res *lockres) -{ - struct ocfs2_dentry_lock *dl = lockres->l_priv; - - return OCFS2_SB(dl->dl_inode->i_sb); -} - void ocfs2_dentry_lock_res_init(struct ocfs2_dentry_lock *dl, u64 parent, struct inode *inode) { @@ -624,6 +615,7 @@ void ocfs2_dentry_lock_res_init(struct ocfs2_dentry_lock *dl, u64 inode_blkno = OCFS2_I(inode)->ip_blkno; __be64 inode_blkno_be = cpu_to_be64(inode_blkno); struct ocfs2_lock_res *lockres = &dl->dl_lockres; + struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); ocfs2_lock_res_init_once(lockres); @@ -652,9 +644,9 @@ void ocfs2_dentry_lock_res_init(struct ocfs2_dentry_lock *dl, memcpy(&lockres->l_name[OCFS2_DENTRY_LOCK_INO_START], &inode_blkno_be, sizeof(__be64)); - ocfs2_lock_res_init_common(OCFS2_SB(inode->i_sb), lockres, + ocfs2_lock_res_init_common(osb, lockres, OCFS2_LOCK_TYPE_DENTRY, &ocfs2_dentry_lops, - dl); + osb); } static void ocfs2_super_lock_res_init(struct ocfs2_lock_res *res, -- 2.53.0