Whamcloud - gitweb
tune2fs/quota: always create hidden quota files
authorAditya Kali <adityakali@google.com>
Fri, 13 Jul 2012 22:25:06 +0000 (15:25 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 16 Jul 2012 01:12:04 +0000 (21:12 -0400)
commit5027751530980c61e313d265b1367fee90589cf4
treefc14de4c3e3ff23ee937cac2a5b506f9c158df72
parent585545e1ee6288e2eafb02937b640301be4a1368
tune2fs/quota: always create hidden quota files

Currently 'tune2fs -O quota <dev>' will try to use existing
quota files and write their inode numbers in the superblock.
Next e2fsck run then converts these into hidden quota inodes
(ino #3 & #4). But this approach has problems:
1) Before e2fsck run, the inodes are visible to the user and
   might get corrupted or removed or replaced by the user.
2) Since these are user visible, we have to include
   their block usage in the quota accounting. But once
   these inodes are hidden, e2fsck will have to decrement
   their usage from the quota accounting (which e2fsck
   currently doesn't do and instead reports error).
   (the following used to give e2fsck error previously:
    # assume <dev> has aquota.user & aquota.group files
    $ tune2fs -O quota <dev> # stores ino# of quota files in
                             # ext4 superblock
    $ e2fsck -f <dev>  # hides quota files, but now quota
                       # usage is incorrect.
     << quota errors >>
Instead of making e2fsck complicated, this patch creates the
hidden quota inodes at 'tune2fs -O quota' time iteself. The
usage is computed freshly and limits are copied from the
aquota.user and aquota.group files as earlier.

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