Re: [RFC][PATCH] PM / Sleep: Freeze filesystems during system suspend/hibernation

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

 



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@xxxxxxx>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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