Re: [Lsf-pc] [LSF/MM/BPF TOPIC] Filesystem Suspend Resume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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






[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux