[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120130235828.GG7827@quack.suse.cz>
Date: Tue, 31 Jan 2012 00:58:28 +0100
From: Jan Kara <jack@...e.cz>
To: "Rafael J. Wysocki" <rjw@...k.pl>
Cc: Jan Kara <jack@...e.cz>, Linux PM list <linux-pm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
linux-fsdevel@...r.kernel.org, Dave Chinner <david@...morbit.com>,
Nigel Cunningham <nigel@...onice.net>,
Pavel Machek <pavel@....cz>,
"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [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@...e.cz>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists