Whamcloud - gitweb
quota: fix e2fsck so we update the quota file correctly
authorTheodore Ts'o <tytso@mit.edu>
Sat, 10 May 2014 05:11:41 +0000 (01:11 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 13 May 2014 14:12:42 +0000 (10:12 -0400)
commitac7ea7b081c119a843ed6105d37461d84baaf544
treefd2a6af7d45dc1bfe1819279ea0279979db305ce
parenta0811c1a0ea18d4aebb4a16e7189501b80d4bc77
quota: fix e2fsck so we update the quota file correctly

In scan_dquota_callback() we were copying dqb_off from the on-disk
dquot structure to the dqot structure that we have constructed in
memory.  This is a bad idea, because if we detect that the quota inode
is corrupted and needs to be replaced, when we later write out the
inode, the fact that we have a non-zero dqb_off value means that quota
routines will not bother updating the quota tree index, since
presumably the quota tree index already has an entry for this dqot.

The problem is that e2fsck, the only user of these functions, has
zapped the quota inode so it can be written from scratch.  So this
means the index for the quota records are not written out, so the
kernel can not find any of the records in the quota inodes.  Oops.

The fix is simple; there is no reason to copy the dqb_off field into
the quota_dict copy of struct dquot.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
lib/quota/mkquota.c