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=1793052292; b=e7Ya4POlpZbO6ACbV4UUSTbq0ktMvB1iWsedS3pL2t5WjYmVI2lzP33m261SvtDlVmqX BaCrA9G1mGmaoY4JFpb0fxYpccOivnpgFM7awlUX0tuVp9q/VjErmI5VN4k4UyKnC5pZa bkriV3KlDyRG1dgfkk5We0n9EWUcOcrCxKYxUlf2dZ7/bp5QULId383CfhVhfVZO6AEGN uz1cZZLAgyQuRK+AtRfsfEhXZAkOvKftZZhLkrfJJRcdWixLgol6F6LPJMVruF4D9wnEf zt1YVCgVOe2Rub3/bIcpr+Q9HThdUDJ54ZLY3RXdvk+M9K3+yb1oELfUnCkgIYf0ytw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793052292; h=Received:DKIM-Signature:Date:To:From:Subject:Message-Id; bh=UvLQiwiBzlLk9UbeuHVIDfOtchdHKuXZ4TiBoUCNvaI=; b=bhF9swj38pUmD93u32DYSwFdL9HUmNwLMIvzOwFee+RAgjKMNVy0Db6uS/E3pByUaqw/ tIPwPDzKhaHnO34FZwDHGtp1FvWCqzEMi45kQ06Z1dNhS8d4QwGoRBRQ9DhUAnbQimL2V bRuFKjEegplm/6u4ezAeL2PIswFV9t3kfwBeC2hV4OR/PV5I1YGS1FdiOp5LOpBTVkUpY v2aRE/qxGzUfU5/tBcfyVrBw0kSmr6Pr23WTv4E3/XyInL26g5pERN7/++bZoZPwTAgtu hvAE0NpalbmjEaa2OsAiRLbkCKXJJg7TTl2FHVy6E2eY9GTA5iWVKvrz7UqC3uS5veg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=HgXBFXpR; 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 296B3606A325; Mon, 26 Oct 2026 22:04:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=HgXBFXpR Received: by smtp.kernel.org (Postfix) with ESMTPSA id A20751F01828; Mon, 26 Oct 2026 22:04:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1793052291; bh=UvLQiwiBzlLk9UbeuHVIDfOtchdHKuXZ4TiBoUCNvaI=; h=Date:To:From:Subject; b=HgXBFXpRHfrkyqSRtbdbp4zM1qvKr5qZUXdOEdrcuXNhH5aajEAwq6T+5lzsxitto HLcuAreHZVkvOirbyU4iS9oYUwfx0+5pCd7UF8JsRiZHGZQ2k0W+oKzUltG6Akx5a6 d+4aAEHZO7RPFo5KtNRZLWFXC/M5DtXnVZtjUzzE= Date: Mon, 26 Oct 2026 15:04:51 -0700 To: mm-commits@vger.kernel.org,stable@vger.kernel.org,mark@fasheh.com, joseph.qi@linux.alibaba.com,jlbec@evilplan.org,jjzuming@gmail.com, heming.zhao@suse.com,baijiaju1990@gmail.com,zzzccc427@gmail.com, akpm@linux-foundation.org From: Andrew Morton Subject: + ocfs2-cache-the-mount-context-for-dentry-lock-callbacks.patch added to mm-nonmm-unstable branch Message-Id: <20261026220451.A20751F01828@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: ocfs2: cache the mount context for dentry lock callbacks has been added to the -mm mm-nonmm-unstable branch. Its filename is ocfs2-cache-the-mount-context-for-dentry-lock-callbacks.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/ocfs2-cache-the-mount-context-for-dentry-lock-callbacks.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Cen Zhang Subject: ocfs2: cache the mount context for dentry lock callbacks Date: Tue, 20 Oct 2026 22:25:53 +0800 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(-) --- a/fs/ocfs2/dcache.h~ocfs2-cache-the-mount-context-for-dentry-lock-callbacks +++ a/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; --- a/fs/ocfs2/dlmglue.c~ocfs2-cache-the-mount-context-for-dentry-lock-callbacks +++ a/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 o }; 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 * { 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(s 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 o 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 o 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, _ Patches currently in -mm which might be from zzzccc427@gmail.com are ocfs2-validate-move-extents-against-a-stable-eof.patch ocfs2-wait-for-filecheck-kobject-release-after-a-failed-add.patch ocfs2-cache-the-mount-context-for-dentry-lock-callbacks.patch