Re: [PATCH][stable] Restore quota state if remount to RO failed v2

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

 



On Thu 31-05-12 16:18:10, Dmitry Monakhov wrote:
> 
> If remount failed due to some reason we have to fallback quota to it's initial state
> otherwise it will state in suspended state which is incorrect.
> 
> #TEST_CASE
> dd if=/dev/zero of=/tmp/imgfile bs=1M count=100
> mkfs.ext4 -F /tmp/imgfile
> mount /tmp/imgfile  /mnt -oloop,quota
> quotacheck -cug /mnt
> quotaon /mnt
> # remount to RO state , and explicitly provide bad option
> mount /mnt -oro,remount,some-bad-option
> # At this point fs is in broken state because it is RW, but quota is in
> # suspended state. Later activity will trigger NULL pointer dereference
> mount /mnt -oro,remount,some-bad-option
> 
> Bug was silently fixed in: e0ccfd959cd890 v2.6.34-7101-ge0ccfd9 while migrating
> to newer quota approach. All previous kernel versions are affected.
> 
> https://jira.sw.ru/browse/PSBM-13231
> 
> Signed-off-by: Dmitry Monakhov <dmonakhov@xxxxxxxxxx>
  The fix looks good so you can add: Acked-by: Jan Kara <jack@xxxxxxx>

									Honza
> ---
>  fs/super.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 

> diff --git a/fs/super.c b/fs/super.c
> index 1fb63e3..e20367b 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -607,8 +607,12 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
>  
>  	if (sb->s_op->remount_fs) {
>  		retval = sb->s_op->remount_fs(sb, &flags, data);
> -		if (retval)
> +		if (retval) {
> +			/* Remount failed, fallback quota to original state */
> +			if (remount_ro)
> +				vfs_dq_quota_on_remount(sb);
>  			return retval;
> +		}
>  	}
>  	sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK);
>  	if (remount_rw)

-- 
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