From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Heming Zhao <heming.zhao@suse.com>,
ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ocfs2: cluster: don't sleep while holding o2hb_live_lock in o2hb_region_pin()
Date: Wed, 22 Jul 2026 10:29:53 +0800 [thread overview]
Message-ID: <1f5f04e9-9284-4e22-9d27-276a524fc05f@linux.alibaba.com> (raw)
In-Reply-To: <20260721105600.4b9532cb049ea1add5e671f6@linux-foundation.org>
On 7/22/26 1:56 AM, Andrew Morton wrote:
> On Tue, 21 Jul 2026 19:49:16 +0800 Joseph Qi <joseph.qi@linux.alibaba.com> wrote:
>
>> o2hb_region_pin() is always called with the o2hb_live_lock spinlock held
>> (from o2hb_region_inc_user() and o2hb_heartbeat_group_drop_item()), but it
>> calls o2nm_depend_item() -> configfs_depend_item(), which sleeps: it pins
>> the configfs filesystem and takes the configfs root inode rwsem. Under
>> CONFIG_DEBUG_ATOMIC_SLEEP this triggers:
>>
>> BUG: sleeping function called from invalid context at kernel/locking/rwsem.c
>> in_atomic(): 1, ... name: mount.ocfs2
>> down_write
>> configfs_depend_item
>> o2hb_region_pin
>> o2hb_region_inc_user
>> o2hb_register_callback
>> dlm_register_domain_handlers
>> ...
>> ocfs2_dlm_init
>> ocfs2_mount_volume
>> ocfs2_fill_super
>>
>> Rework o2hb_region_pin() to pin one region at a time with the lock
>> dropped across the sleeping call: under o2hb_live_lock find the next
>> eligible region and take a config_item reference to keep it alive, drop
>> the lock, call o2nm_depend_item(), then retake the lock and record the
>> pin. The config_item_put() is done with the lock released as well, since
>> o2hb_region_release() also acquires o2hb_live_lock and can sleep. The
>> region list may change while unlocked, so the scan restarts from the
>> top after each pin. Local heartbeat still pins only the matching region;
>> global heartbeat pins all eligible regions.
>
> Thanks, I'll add cc:stable to this.
>
> Sashiko might have a found a couple of pre-existing issues in there:
>
> https://sashiko.dev/#/patchset/20260721114916.2098617-1-joseph.qi@linux.alibaba.com
Thanks, the two comments seems real pre-existing issues.
I'll look into them later.
Thanks,
Joseph
prev parent reply other threads:[~2026-07-22 2:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 11:49 Joseph Qi
2026-07-21 17:56 ` Andrew Morton
2026-07-22 2:29 ` Joseph Qi [this message]
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=1f5f04e9-9284-4e22-9d27-276a524fc05f@linux.alibaba.com \
--to=joseph.qi@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=heming.zhao@suse.com \
--cc=linux-kernel@vger.kernel.org \
--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®