Re: [PATCH 3/3] vfs: fix filesystem_sync vs write race on rw=>ro remount v2

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

 



On Tue 02-03-10 17:04:26, Dmitry Monakhov wrote:
> Jan Kara <jack@xxxxxxx> writes:
> 
> > On Sat 27-02-10 03:25:49, Dmitry Monakhov wrote:
> >> +/**
> >> + * Check whenever is it possible to remount given sb to readonly.
> >> + * @sb : super block in question
> >> + *
> >> + * Caller is responsible to set ST_REMOUNT_RO state before the call.
> >> + */
> >> +int fs_may_remount_ro(struct super_block *sb)
> >> +{
> >> +	struct vfsmount *mnt;
> >> +	int ret = 1;
> >> +	spin_lock(&vfsmount_lock);
> >> +	list_for_each_entry(mnt, &sb->s_vfsmount, mnt_sb_list) {
> >> +		ret = !mnt_check_writers(mnt, 0);
> >> +		if (ret)
> >> +			break;
> >> +	}
> >> +	spin_unlock(&vfsmount_lock);
> >> +	/*
> >> +	 * If new writer appears after we have checked all vfsmounts.
> >> +	 * Then ST_REMOUNT_RO bit will be cleared.
> >> +	 */
> >> +	if (!test_bit(ST_REMOUNT_RO, &sb->s_state))
> >> +		ret = 0;
> >> +	return ret;
> >> +}
> >   This misses the case when the superblock as unlinked-but-open files.
> > In such case we have to fail remount RO as well. The original
> > fs_may_remount_ro checks for that..
> Since file is opened for write one of vfsmnt struct would have non
> zero write count. So -EBUSY will be returned from fs_may_remount_ro()
  But file can be open for reading only...

								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