[Ocfs2-tools-devel] [PATCH 1/1] Ocfs2-tools: Warn user when doing quota corruption on a none-quota supported volume.

Joel Becker Joel.Becker at oracle.com
Tue Oct 13 22:42:02 PDT 2009


On Wed, Oct 14, 2009 at 12:26:24PM +0800, Tristan Ye wrote:
> It will be better to warn user when doing quota corruption on a volume
> without usrquota and grpquota enabled than failout with a fatal error.
> 
> Btw, the patch also fix a tiny compiling warning.

	Looks good, sob.

> 
> Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
> ---
>  fswreck/quota.c |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/fswreck/quota.c b/fswreck/quota.c
> index 4d49cec..6837aa0 100644
> --- a/fswreck/quota.c
> +++ b/fswreck/quota.c
> @@ -127,6 +127,13 @@ void mess_up_quota(ocfs2_filesys *fs, enum fsck_type type, uint16_t slotnum)
>  	struct ocfs2_global_disk_dqblk *ddquot;
>  	struct qt_disk_dqdbheader *dh;
>  
> +	if ((!OCFS2_HAS_RO_COMPAT_FEATURE(OCFS2_RAW_SB(fs->fs_super),
> +	      OCFS2_FEATURE_RO_COMPAT_USRQUOTA)) ||
> +	    (!OCFS2_HAS_RO_COMPAT_FEATURE(OCFS2_RAW_SB(fs->fs_super),
> +	      OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)))
> +		FSWRK_FATAL("Should specify a volume with both usrquota and "
> +			    "grpquota enabled to do this corruption.\n");
> +
>  	ret = ocfs2_init_fs_quota_info(fs, USRQUOTA);
>  	if (ret)
>  		FSWRK_COM_FATAL(progname, ret);
> @@ -212,7 +219,7 @@ void mess_up_quota(ocfs2_filesys *fs, enum fsck_type type, uint16_t slotnum)
>  		ocfs2_swap_quota_leaf_block_header(dh);
>  		dh->dqdh_next_free = 0xFFFFFFFF;
>  		dh->dqdh_prev_free = 0xFFFFFFFF;
> -		dh->dqdh_entries = 0xFFFFFFFF;
> +		dh->dqdh_entries = 0xFFFF;
>  		ocfs2_swap_quota_leaf_block_header(dh);
>  
>  		ret = o2fswreck_write_blk(fs, qtype,
> @@ -248,7 +255,7 @@ void mess_up_quota(ocfs2_filesys *fs, enum fsck_type type, uint16_t slotnum)
>  		ocfs2_swap_quota_leaf_block_header(dh);
>  		dh->dqdh_next_free = 0xFFFFFFFF;
>  		dh->dqdh_prev_free = 0xFFFFFFFF;
> -		dh->dqdh_entries = 0xFFFFFFFF;
> +		dh->dqdh_entries = 0xFFFF;
>  		ocfs2_swap_quota_leaf_block_header(dh);
>  
>  		ret = o2fswreck_write_blk(fs, qtype,
> -- 
> 1.5.5
> 
> 
> _______________________________________________
> Ocfs2-tools-devel mailing list
> Ocfs2-tools-devel at oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel

-- 

"But all my words come back to me
 In shades of mediocrity.
 Like emptiness in harmony
 I need someone to comfort me."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-tools-devel mailing list