lkml.org 
[lkml]   [2012]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH] PM / Sleep: Freeze filesystems during system suspend/hibernation
On Mon 30-01-12 22:05:33, Rafael J. Wysocki wrote:
> On Monday, January 30, 2012, Jan Kara wrote:
> > On Sat 28-01-12 14:45:49, Rafael J. Wysocki wrote:
> > > +/**
> > > + * freeze_supers - call freeze_super() for all superblocks
> > > + */
> > > +int freeze_supers(void)
> > > +{
> > > + struct super_block *sb, *p = NULL;
> > > + int error = 0;
> > > +
> > > + spin_lock(&sb_lock);
> > > + /*
> > > + * Freeze in reverse order so filesystems depending on others are
> > > + * frozen in the right order (eg. loopback on ext3).
> > > + */
> > Ho, hum, are you sure the order in super_blocks list is the one you need?
> > Maybe it is but I'm not sure you are guaranteed it is.
>
> Well, is there any way I can get the right order?
None I'm aware of :( I think your reverse order scanning is the best you
can do now as we don't track the "freeze dependency" in any way. I was just
warning that noone really guarantees this is the right order. So we should
probably at least document somewhere that super_blocks list order matters
for freeze_supers().

> > > + list_for_each_entry_reverse(sb, &super_blocks, s_list) {
> > > + if (list_empty(&sb->s_instances))
> > > + continue;
> > > + sb->s_count++;
> > > + spin_unlock(&sb_lock);
> > > +
> > > + if (sb->s_root && sb->s_frozen != SB_FREEZE_TRANS
> > > + && !(sb->s_flags & MS_RDONLY)) {
> > > + error = freeze_super(sb);
> > > + if (!error)
> > > + sb->s_flags |= MS_FROZEN;
> > > + }
> > > +
> > > + spin_lock(&sb_lock);
> > > + if (error)
> > > + break;
> > > + if (p)
> > > + __put_super(p);
> > > + p = sb;
> > > + }
> > > + if (p)
> > > + __put_super(p);
> > > + spin_unlock(&sb_lock);
> > > +
> > > + if (error)
> > > + thaw_supers();
> > > +
> > > + return error;
> > > +}
> > > +
> > > +
> > > +/**
> > > * get_super - get the superblock of a device
> > > * @bdev: device to get the superblock for
> > > *

Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR


\
 
 \ /
  Last update: 2012-01-31 01:01    [W:0.053 / U:3.604 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site