[Ocfs2-tools-devel] [PATCH 1/1] Ocfs2-tools: Warn user when doing quota corruption on a none-quota supported volume.
Tristan Ye
tristan.ye at oracle.com
Tue Oct 13 21:26:24 PDT 2009
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.
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
More information about the Ocfs2-tools-devel
mailing list