diff options
Diffstat (limited to 'fs/reiserfs/super.c')
-rw-r--r-- | fs/reiserfs/super.c | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 59125fb36d42..9822fa15118b 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -158,6 +158,7 @@ static int finish_unfinished(struct super_block *s) | |||
158 | #ifdef CONFIG_QUOTA | 158 | #ifdef CONFIG_QUOTA |
159 | int i; | 159 | int i; |
160 | int ms_active_set; | 160 | int ms_active_set; |
161 | int quota_enabled[MAXQUOTAS]; | ||
161 | #endif | 162 | #endif |
162 | 163 | ||
163 | /* compose key to look for "save" links */ | 164 | /* compose key to look for "save" links */ |
@@ -179,8 +180,15 @@ static int finish_unfinished(struct super_block *s) | |||
179 | } | 180 | } |
180 | /* Turn on quotas so that they are updated correctly */ | 181 | /* Turn on quotas so that they are updated correctly */ |
181 | for (i = 0; i < MAXQUOTAS; i++) { | 182 | for (i = 0; i < MAXQUOTAS; i++) { |
183 | quota_enabled[i] = 1; | ||
182 | if (REISERFS_SB(s)->s_qf_names[i]) { | 184 | if (REISERFS_SB(s)->s_qf_names[i]) { |
183 | int ret = reiserfs_quota_on_mount(s, i); | 185 | int ret; |
186 | |||
187 | if (sb_has_quota_active(s, i)) { | ||
188 | quota_enabled[i] = 0; | ||
189 | continue; | ||
190 | } | ||
191 | ret = reiserfs_quota_on_mount(s, i); | ||
184 | if (ret < 0) | 192 | if (ret < 0) |
185 | reiserfs_warning(s, "reiserfs-2500", | 193 | reiserfs_warning(s, "reiserfs-2500", |
186 | "cannot turn on journaled " | 194 | "cannot turn on journaled " |
@@ -304,8 +312,8 @@ static int finish_unfinished(struct super_block *s) | |||
304 | #ifdef CONFIG_QUOTA | 312 | #ifdef CONFIG_QUOTA |
305 | /* Turn quotas off */ | 313 | /* Turn quotas off */ |
306 | for (i = 0; i < MAXQUOTAS; i++) { | 314 | for (i = 0; i < MAXQUOTAS; i++) { |
307 | if (sb_dqopt(s)->files[i]) | 315 | if (sb_dqopt(s)->files[i] && quota_enabled[i]) |
308 | vfs_quota_off(s, i, 0); | 316 | dquot_quota_off(s, i); |
309 | } | 317 | } |
310 | if (ms_active_set) | 318 | if (ms_active_set) |
311 | /* Restore the flag back */ | 319 | /* Restore the flag back */ |
@@ -466,6 +474,8 @@ static void reiserfs_put_super(struct super_block *s) | |||
466 | struct reiserfs_transaction_handle th; | 474 | struct reiserfs_transaction_handle th; |
467 | th.t_trans_id = 0; | 475 | th.t_trans_id = 0; |
468 | 476 | ||
477 | dquot_disable(s, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); | ||
478 | |||
469 | reiserfs_write_lock(s); | 479 | reiserfs_write_lock(s); |
470 | 480 | ||
471 | if (s->s_dirt) | 481 | if (s->s_dirt) |
@@ -620,7 +630,7 @@ static int reiserfs_acquire_dquot(struct dquot *); | |||
620 | static int reiserfs_release_dquot(struct dquot *); | 630 | static int reiserfs_release_dquot(struct dquot *); |
621 | static int reiserfs_mark_dquot_dirty(struct dquot *); | 631 | static int reiserfs_mark_dquot_dirty(struct dquot *); |
622 | static int reiserfs_write_info(struct super_block *, int); | 632 | static int reiserfs_write_info(struct super_block *, int); |
623 | static int reiserfs_quota_on(struct super_block *, int, int, char *, int); | 633 | static int reiserfs_quota_on(struct super_block *, int, int, char *); |
624 | 634 | ||
625 | static const struct dquot_operations reiserfs_quota_operations = { | 635 | static const struct dquot_operations reiserfs_quota_operations = { |
626 | .write_dquot = reiserfs_write_dquot, | 636 | .write_dquot = reiserfs_write_dquot, |
@@ -634,12 +644,12 @@ static const struct dquot_operations reiserfs_quota_operations = { | |||
634 | 644 | ||
635 | static const struct quotactl_ops reiserfs_qctl_operations = { | 645 | static const struct quotactl_ops reiserfs_qctl_operations = { |
636 | .quota_on = reiserfs_quota_on, | 646 | .quota_on = reiserfs_quota_on, |
637 | .quota_off = vfs_quota_off, | 647 | .quota_off = dquot_quota_off, |
638 | .quota_sync = vfs_quota_sync, | 648 | .quota_sync = dquot_quota_sync, |
639 | .get_info = vfs_get_dqinfo, | 649 | .get_info = dquot_get_dqinfo, |
640 | .set_info = vfs_set_dqinfo, | 650 | .set_info = dquot_set_dqinfo, |
641 | .get_dqblk = vfs_get_dqblk, | 651 | .get_dqblk = dquot_get_dqblk, |
642 | .set_dqblk = vfs_set_dqblk, | 652 | .set_dqblk = dquot_set_dqblk, |
643 | }; | 653 | }; |
644 | #endif | 654 | #endif |
645 | 655 | ||
@@ -1242,6 +1252,11 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) | |||
1242 | if (s->s_flags & MS_RDONLY) | 1252 | if (s->s_flags & MS_RDONLY) |
1243 | /* it is read-only already */ | 1253 | /* it is read-only already */ |
1244 | goto out_ok; | 1254 | goto out_ok; |
1255 | |||
1256 | err = dquot_suspend(s, -1); | ||
1257 | if (err < 0) | ||
1258 | goto out_err; | ||
1259 | |||
1245 | /* try to remount file system with read-only permissions */ | 1260 | /* try to remount file system with read-only permissions */ |
1246 | if (sb_umount_state(rs) == REISERFS_VALID_FS | 1261 | if (sb_umount_state(rs) == REISERFS_VALID_FS |
1247 | || REISERFS_SB(s)->s_mount_state != REISERFS_VALID_FS) { | 1262 | || REISERFS_SB(s)->s_mount_state != REISERFS_VALID_FS) { |
@@ -1295,6 +1310,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) | |||
1295 | s->s_dirt = 0; | 1310 | s->s_dirt = 0; |
1296 | 1311 | ||
1297 | if (!(*mount_flags & MS_RDONLY)) { | 1312 | if (!(*mount_flags & MS_RDONLY)) { |
1313 | dquot_resume(s, -1); | ||
1298 | finish_unfinished(s); | 1314 | finish_unfinished(s); |
1299 | reiserfs_xattr_init(s, *mount_flags); | 1315 | reiserfs_xattr_init(s, *mount_flags); |
1300 | } | 1316 | } |
@@ -2022,15 +2038,15 @@ static int reiserfs_write_info(struct super_block *sb, int type) | |||
2022 | */ | 2038 | */ |
2023 | static int reiserfs_quota_on_mount(struct super_block *sb, int type) | 2039 | static int reiserfs_quota_on_mount(struct super_block *sb, int type) |
2024 | { | 2040 | { |
2025 | return vfs_quota_on_mount(sb, REISERFS_SB(sb)->s_qf_names[type], | 2041 | return dquot_quota_on_mount(sb, REISERFS_SB(sb)->s_qf_names[type], |
2026 | REISERFS_SB(sb)->s_jquota_fmt, type); | 2042 | REISERFS_SB(sb)->s_jquota_fmt, type); |
2027 | } | 2043 | } |
2028 | 2044 | ||
2029 | /* | 2045 | /* |
2030 | * Standard function to be called on quota_on | 2046 | * Standard function to be called on quota_on |
2031 | */ | 2047 | */ |
2032 | static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, | 2048 | static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, |
2033 | char *name, int remount) | 2049 | char *name) |
2034 | { | 2050 | { |
2035 | int err; | 2051 | int err; |
2036 | struct path path; | 2052 | struct path path; |
@@ -2039,9 +2055,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, | |||
2039 | 2055 | ||
2040 | if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA))) | 2056 | if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA))) |
2041 | return -EINVAL; | 2057 | return -EINVAL; |
2042 | /* No more checks needed? Path and format_id are bogus anyway... */ | 2058 | |
2043 | if (remount) | ||
2044 | return vfs_quota_on(sb, type, format_id, name, 1); | ||
2045 | err = kern_path(name, LOOKUP_FOLLOW, &path); | 2059 | err = kern_path(name, LOOKUP_FOLLOW, &path); |
2046 | if (err) | 2060 | if (err) |
2047 | return err; | 2061 | return err; |
@@ -2085,7 +2099,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, | |||
2085 | if (err) | 2099 | if (err) |
2086 | goto out; | 2100 | goto out; |
2087 | } | 2101 | } |
2088 | err = vfs_quota_on_path(sb, type, format_id, &path); | 2102 | err = dquot_quota_on_path(sb, type, format_id, &path); |
2089 | out: | 2103 | out: |
2090 | path_put(&path); | 2104 | path_put(&path); |
2091 | return err; | 2105 | return err; |