From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>,
Heming Zhao <heming.zhao@suse.com>
Cc: ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/3] ocfs2: cluster: o2hb_region_pin() fixes
Date: Wed, 22 Jul 2026 20:49:30 +0800 [thread overview]
Message-ID: <20260722124933.430554-1-joseph.qi@linux.alibaba.com> (raw)
This series fixes three related issues in o2hb_region_pin(), all are
from the original implementation in commit:
58a3158a5d17 ("ocfs2/cluster: Pin/unpin o2hb regions"):
1) It is called with o2hb_live_lock (a spinlock) held, but the
underlying configfs_depend_item() sleeps (takes inode rwsem and
pins the filesystem). This triggers BUG under
CONFIG_DEBUG_ATOMIC_SLEEP.
2) When called from the configfs drop_item callback, it creates a
lock order inversion: parent inode_lock -> configfs root
inode_lock, which can deadlock against subsystem unregistration
paths taking root -> parent.
3) If pinning fails partway through o2hb_region_inc_user(), the
o2hb_dependent_users counter is leaked and partially-pinned
regions are never released, leaving heartbeat regions
unprotected on subsequent mounts.
Patch 1 reworks o2hb_region_pin() to drop o2hb_live_lock across
each sleeping configfs_depend_item() call, using a config_item
reference to keep the region alive while unlocked.
Patch 2 adds a from_callback parameter to select
configfs_depend_item_unlocked() when called from configfs context,
avoiding the inode_lock nesting.
Patch 3 fixes the error path in o2hb_region_inc_user() to unpin
and decrement the counter on failure.
Joseph Qi (3):
ocfs2: cluster: don't sleep while holding o2hb_live_lock in
o2hb_region_pin()
ocfs2: cluster: avoid lock order inversion in o2hb_region_pin() from
drop_item
ocfs2: cluster: fix o2hb_dependent_users leak on pin failure
fs/ocfs2/cluster/heartbeat.c | 146 ++++++++++++++++++++++++++-------
fs/ocfs2/cluster/nodemanager.c | 6 ++
fs/ocfs2/cluster/nodemanager.h | 1 +
3 files changed, 122 insertions(+), 31 deletions(-)
--
2.39.3
next reply other threads:[~2026-07-22 12:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 12:49 Joseph Qi [this message]
2026-07-22 12:49 ` [PATCH v2 1/3] ocfs2: cluster: don't sleep while holding o2hb_live_lock in o2hb_region_pin() Joseph Qi
2026-07-22 12:49 ` [PATCH v2 2/3] ocfs2: cluster: avoid lock order inversion in o2hb_region_pin() from drop_item Joseph Qi
2026-07-22 12:49 ` [PATCH v2 3/3] ocfs2: cluster: fix o2hb_dependent_users leak on pin failure Joseph Qi
2026-07-22 23:43 ` [PATCH v2 0/3] ocfs2: cluster: o2hb_region_pin() fixes Andrew Morton
2026-07-23 1:13 ` Joseph Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260722124933.430554-1-joseph.qi@linux.alibaba.com \
--to=joseph.qi@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=heming.zhao@suse.com \
--cc=jlbec@evilplan.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark@fasheh.com \
--cc=ocfs2-devel@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®