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=1794273460; b=tqh2R7oq1CDhfjhflnyeRqKw3XMEd3WHvIp2RcxsyaGkZW9GJPioVsgogNVgn5oYmlPb wE9dvINsNVOUDH6mZkCN/7Cf9eucvHIzZ/prGFTTPjIdpPekZEiRw/QdaBNobbzNsJOs9 ESm5tJ+nXm1eD7Sq+rQ2HPu1aJgDgwJx+4xOzqYeMSiEdx0ssRt+l58lxHE6jT7Yz0d2q lF0USA7mKdmQJdTkirluIXweGep6oN0CNRqDnoH+72A8zn3OKn+B1UxmsgKy2QAC/oJDa 4M8ATswyn1HL3cmyufjiO1XYGKg/rX424p+WQd9pDbyCuZoX0ulFly5Dj5SWp4hKk+g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794273460; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=xip1Nz+McmAdcZxcZqErkt8Eux+Js55S320HvyoyQfQ=; b=a3nqzDpK3ARFnDNflLxTzBo1reK3U03YNVwkxU06q0sYGypHtc0UGcEVzeqhRaRdmJJ2 gCMzpjGolI+UesT+/hxHY+1qB7y0TokniUWO7vpX1Rz5B0zIYThvj5Ey72NsmSmIxkZuI nKVReB1fYa+ye1bc6HXtAicjXAHXkHQ2SvgO0v0RLMfFJ3qRe2617WbVeLrhFvNhn0hym DC8UxCV5MNy1FV8oTb/6BjbmzuE9Bt1qPgCKHIikkXxXMnC2oe/XCgQBk2acMTRwR7x4B RPi4nRkti7+NG6MnD/k2sWp/ULZhj3THNcYosLkBVk9bL/wIS7xQ+w345DJv9yRaZqQ== 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="a5d/nJGh"; 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 461F9606A321 for ; Tue, 10 Nov 2026 01:17:40 +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=a5d/nJGh Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FC621F0089F; Tue, 10 Nov 2026 01:17:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794273460; bh=xip1Nz+McmAdcZxcZqErkt8Eux+Js55S320HvyoyQfQ=; h=From:To:Cc:Subject:Date; b=a5d/nJGhRMjVW/O+itUJAzr4NLG4HqPrO6G6XLefrfoxOIHnFW/DqR/Pe47rhRrWg LDrDxiKAVUIDGSi8kb5vFbMcSuWVZXMDWSTvD198XXifrD/1YViiVZc+xH5lws+LRA j4iCvNOsDex6Qhj260eDPXMhO7xicROSVDN7wImXs0DPr9VwAYe+cqpMtPnhAqGQt9 APyh7N84vgE2hBi0Se0XxgseYrSxdoBiFzTk4PB/H+ClEYWOwpTaufrZPNUvpdp1oG huAOE+m13lCNbwDX0TMdDnxdUf058Im9VUuCK0TwxT7Medig60CnrKqTlIZkrVM8He fLIjJ4yOXJHDQ== 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 6.1-stable tree Date: Mon, 9 Nov 2026 20:17:37 -0500 Message-ID: <20261109201737-failed-6.1-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 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 5b4696e0bfc358619adaeab25ad35b4979af8331 # git commit -s git send-email --to '' --in-reply-to '20261109201737-failed-6.1-5b4696e0bfc3@kernel.org' --subject-prefix 'PATCH 6.1.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