From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Jan Kara <jack@suse.cz>, Dave Chinner <david@fromorbit.com>
Cc: Christoph Hellwig <hch@infradead.org>,
linux-fsdevel@vger.kernel.org,
lsf-pc@lists.linux-foundation.org,
"Rafael J. Wysocki" <rafael@kernel.org>,
Pavel Machek <pavel@kernel.org>, Len Brown <len.brown@intel.com>,
linux-pm@vger.kernel.org
Subject: Re: [Lsf-pc] [LSF/MM/BPF TOPIC] Filesystem Suspend Resume
Date: Tue, 25 Mar 2025 22:36:56 -0400 [thread overview]
Message-ID: <1af829aa7a65eb5ebc0614a00f7019615ed0f62b.camel@HansenPartnership.com> (raw)
In-Reply-To: <l6qesrzfadpiknnpy7dare7pfnxyfjljseuxvhjcajszymktu3@oitqnbt6fwvr>
On Tue, 2025-03-25 at 14:42 +0100, Jan Kara wrote:
[...]
> If I remember correctly, the problem in the past was, that if you
> leave userspace running while freezing filesystems, some processes
> may enter uninterruptible sleep waiting for fs to be thawed and in
> the past suspend code was not able to hibernate such processes. But I
> think this obstacle has been removed couple of years ago as now we
> could use TASK_FREEZABLE flag in sb_start_write() ->
> percpu_rwsem_wait and thus allow tasks blocked on frozen filesystem
> to be hibernated.
I tested this and we do indeed deadlock hibernation on the processes
touching the filesystem (systemd-journald actually). But if I make
this change:
diff --git a/kernel/locking/percpu-rwsem.c b/kernel/locking/percpu-rwsem.c
index 6083883c4fe0..720418720bbc 100644
--- a/kernel/locking/percpu-rwsem.c
+++ b/kernel/locking/percpu-rwsem.c
@@ -156,7 +156,7 @@ static void percpu_rwsem_wait(struct percpu_rw_semaphore *sem, bool reader)
spin_unlock_irq(&sem->waiters.lock);
while (wait) {
- set_current_state(TASK_UNINTERRUPTIBLE);
+ set_current_state(TASK_UNINTERRUPTIBLE|TASK_FREEZABLE);
if (!smp_load_acquire(&wq_entry.private))
break;
schedule();
Then everything will work, with no lockdep problems (thanks,
Christian). Is that the change you want me to make or should
sb_start_write be using a special freezable version of
percpu_rwsem_wait()?
Regards,
James
next prev parent reply other threads:[~2025-03-26 2:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <0a76e074ef262ca857c61175dd3d0dc06b67ec42.camel@HansenPartnership.com>
[not found] ` <Z9xG2l8lm7ha3Pf2@infradead.org>
[not found] ` <acae7a99f8acb0ebf408bb6fc82ab53fb687559c.camel@HansenPartnership.com>
2025-03-21 5:23 ` [LSF/MM/BPF TOPIC] Filesystem Suspend Resume Christoph Hellwig
2025-03-21 12:34 ` James Bottomley
2025-03-21 17:00 ` James Bottomley
2025-03-21 17:17 ` Lukas Wunner
2025-03-21 18:20 ` James Bottomley
2025-03-24 11:38 ` [Lsf-pc] " Jan Kara
2025-03-24 14:34 ` James Bottomley
2025-03-24 19:28 ` Jan Kara
2025-03-27 14:55 ` Eric Sandeen
2025-03-27 17:30 ` Jan Kara
2025-03-24 20:56 ` Dave Chinner
2025-03-24 20:50 ` Dave Chinner
2025-03-24 21:02 ` James Bottomley
2025-03-24 21:07 ` Dave Chinner
2025-03-25 13:42 ` Jan Kara
2025-03-26 2:36 ` James Bottomley [this message]
2025-03-26 14:59 ` Jan Kara
2025-03-26 15:25 ` James Bottomley
2025-03-27 14:28 ` James Bottomley
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=1af829aa7a65eb5ebc0614a00f7019615ed0f62b.camel@HansenPartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=len.brown@intel.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lsf-pc@lists.linux-foundation.org \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
/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