1 commit ca0e05e4b15193aeba72b995e90de990db7f8304
2 Author: Dmitry Monakhov <dmonakhov@openvz.org>
3 Date: Sun Aug 1 17:48:36 2010 -0400
5 ext4: force block allocation on quota_off
7 Perform full sync procedure so that any delayed allocation blocks are
8 allocated so quota will be consistent.
10 Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
11 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
13 Index: linux-stage/fs/ext4/super.c
14 ===================================================================
15 --- linux-stage.orig/fs/ext4/super.c 2012-06-26 09:37:06.039508000 +0200
16 +++ linux-stage/fs/ext4/super.c 2012-06-26 11:35:09.824099000 +0200
17 @@ -1104,6 +1104,7 @@ static int ext4_mark_dquot_dirty(struct
18 static int ext4_write_info(struct super_block *sb, int type);
19 static int ext4_quota_on(struct super_block *sb, int type, int format_id,
20 char *path, int remount);
21 +static int ext4_quota_off(struct super_block *sb, int type, int remount);
22 static int ext4_quota_on_mount(struct super_block *sb, int type);
23 static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
24 size_t len, loff_t off);
25 @@ -1173,7 +1174,7 @@ static const struct dquot_operations ext
27 static const struct quotactl_ops ext4_qctl_operations = {
28 .quota_on = ext4_quota_on,
29 - .quota_off = vfs_quota_off,
30 + .quota_off = ext4_quota_off,
31 .quota_sync = vfs_quota_sync,
32 .get_info = vfs_get_dqinfo,
33 .set_info = vfs_set_dqinfo,
34 @@ -4578,6 +4579,28 @@ static int ext4_quota_on(struct super_bl
38 +static int ext4_quota_off(struct super_block *sb, int type, int remount)
40 + struct quota_info *dqopt = sb_dqopt(sb);
42 + mutex_lock(&dqopt->dqonoff_mutex);
43 + if (!sb_any_quota_loaded(sb)) {
45 + mutex_unlock(&dqopt->dqonoff_mutex);
48 + mutex_unlock(&dqopt->dqonoff_mutex);
50 + /* Force all delayed allocation blocks to be allocated. */
51 + if (test_opt(sb, DELALLOC)) {
52 + down_read(&sb->s_umount);
53 + sync_filesystem(sb);
54 + up_read(&sb->s_umount);
57 + return vfs_quota_off(sb, type, remount);
60 /* Read data from quotafile - avoid pagecache and such because we cannot afford
61 * acquiring the locks... As quota files are never truncated and quota code
62 * itself serializes the operations (and noone else should touch the files)