Commit Message

On Sunday, August 07, 2011, Dave Chinner wrote:
> On Sat, Aug 06, 2011 at 11:17:18PM +0200, Rafael J. Wysocki wrote:> > From: Rafael J. Wysocki <rjw@sisk.pl>
...
> > + /*> > + * Freeze in reverse order so filesystems depending on others are> > + * frozen in the right order (eg. loopback on ext3).> > + */> > + list_for_each_entry_reverse(sb, &super_blocks, s_list) {> > + if (!sb->s_root || !sb->s_bdev ||> > + (sb->s_frozen == SB_FREEZE_TRANS) ||> > + (sb->s_flags & MS_RDONLY))> > + continue;> > +> > + freeze_bdev(sb->s_bdev);> > + sb->s_flags |= MS_FROZEN;> > + }> > AFAIK, that won't work for btrfs - you have to call freeze_super()> directly for btrfs because it has a special relationship with> sb->s_bdev. And besides, all freeze_bdev does is get an active> reference on the superblock and call freeze_super().> > Also, that's traversing the list of superblock with locking and> dereferencing the superblock without properly checking that the> superblock is not being torn down. You should probably use> iterate_supers (or at least copy the code), with a function that> drops the s_umount read lock befor calling freeze_super() and then> picks it back up afterwards.
So, what about the patch below? It appears to work on my test boxes.
Thanks,
Rafael
---
From: Rafael J. Wysocki <rjw@sisk.pl>
Subject: PM / Freezer: Freeze filesystems while freezing processes (v3)
Freeze all filesystems during the freezing of tasks by calling
freeze_super() for all superblocks and thaw them during the thawing
of tasks with the help of thaw_super().
This is needed by hibernation, because some filesystems (e.g. XFS)
deadlock with the preallocation of memory used by it if the memory
pressure caused by it is too heavy.
The additional benefit of this change is that, if something goes
wrong after filesystems have been frozen, they will stay in a
consistent state and journal replays won't be necessary (e.g. after
a failing suspend or resume). In particular, this should help to
solve a long-standing issue that in some cases during resume from
hibernation the boot loader causes the journal to be replied for the
filesystem containing the kernel image and initrd causing it to
become inconsistent with the information stored in the hibernation
image.
This change is based on earlier work by Nigel Cunningham.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
fs/super.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++
include/linux/fs.h | 3 ++
kernel/power/process.c | 9 +++++-
3 files changed, 81 insertions(+), 1 deletion(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html