]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ext4: force block allocation on quota_off
authorDmitry Monakhov <dmonakhov@openvz.org>
Sun, 1 Aug 2010 21:48:36 +0000 (17:48 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 1 Aug 2010 21:48:36 +0000 (17:48 -0400)
Perform full sync procedure so that any delayed allocation blocks are
allocated so quota will be consistent.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/super.c

index 282a2704be2399acd8c1e61f5ccbba8674710e61..3e3f6484c22335e19f426d693ad68b7f4f303e6a 100644 (file)
@@ -1118,6 +1118,7 @@ static int ext4_mark_dquot_dirty(struct dquot *dquot);
 static int ext4_write_info(struct super_block *sb, int type);
 static int ext4_quota_on(struct super_block *sb, int type, int format_id,
                                char *path);
+static int ext4_quota_off(struct super_block *sb, int type);
 static int ext4_quota_on_mount(struct super_block *sb, int type);
 static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
                               size_t len, loff_t off);
@@ -1139,7 +1140,7 @@ static const struct dquot_operations ext4_quota_operations = {
 
 static const struct quotactl_ops ext4_qctl_operations = {
        .quota_on       = ext4_quota_on,
-       .quota_off      = dquot_quota_off,
+       .quota_off      = ext4_quota_off,
        .quota_sync     = dquot_quota_sync,
        .get_info       = dquot_get_dqinfo,
        .set_info       = dquot_set_dqinfo,
@@ -4098,6 +4099,18 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
        return err;
 }
 
+static int ext4_quota_off(struct super_block *sb, int type)
+{
+       /* Force all delayed allocation blocks to be allocated */
+       if (test_opt(sb, DELALLOC)) {
+               down_read(&sb->s_umount);
+               sync_filesystem(sb);
+               up_read(&sb->s_umount);
+       }
+
+       return dquot_quota_off(sb, type);
+}
+
 /* Read data from quotafile - avoid pagecache and such because we cannot afford
  * acquiring the locks... As quota files are never truncated and quota code
  * itself serializes the operations (and noone else should touch the files)