Commit e0ccfd959cd8907bcb66cc2042e0f4fd7fcbff2b

Authored by Christoph Hellwig
Committed by Jan Kara
1 parent 0f0dd62fdd

quota: move unmount handling into the filesystem

Currently the VFS calls into the quotactl interface for unmounting
filesystems.  This means filesystems with their own quota handling
can't easily distinguish between user-space originating quotaoff
and an unount.  Instead move the responsibily of the unmount handling
into the filesystem to be consistent with all other dquot handling.

Note that we do call dquot_disable a lot later now, e.g. after
a sync_filesystem.  But this is fine as the quota code does all its
writes via blockdev's mapping and that is synced even later.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>

Showing 9 changed files with 14 additions and 16 deletions Side-by-side Diff

... ... @@ -119,6 +119,8 @@
119 119 int i;
120 120 struct ext2_sb_info *sbi = EXT2_SB(sb);
121 121  
  122 + dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
  123 +
122 124 if (sb->s_dirt)
123 125 ext2_write_super(sb);
124 126  
... ... @@ -410,6 +410,8 @@
410 410 struct ext3_super_block *es = sbi->s_es;
411 411 int i, err;
412 412  
  413 + dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
  414 +
413 415 lock_kernel();
414 416  
415 417 ext3_xattr_put_super(sb);
... ... @@ -645,6 +645,8 @@
645 645 struct ext4_super_block *es = sbi->s_es;
646 646 int i, err;
647 647  
  648 + dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
  649 +
648 650 flush_workqueue(sbi->dio_unwritten_wq);
649 651 destroy_workqueue(sbi->dio_unwritten_wq);
650 652  
... ... @@ -179,6 +179,8 @@
179 179  
180 180 jfs_info("In jfs_put_super");
181 181  
  182 + dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
  183 +
182 184 lock_kernel();
183 185  
184 186 rc = jfs_umount(sb);
... ... @@ -466,6 +466,8 @@
466 466 struct reiserfs_transaction_handle th;
467 467 th.t_trans_id = 0;
468 468  
  469 + dquot_disable(s, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
  470 +
469 471 reiserfs_write_lock(s);
470 472  
471 473 if (s->s_dirt)
... ... @@ -160,7 +160,6 @@
160 160 {
161 161 struct file_system_type *fs = s->s_type;
162 162 if (atomic_dec_and_test(&s->s_active)) {
163   - vfs_dq_off(s, 0);
164 163 fs->kill_sb(s);
165 164 put_filesystem(fs);
166 165 put_super(s);
... ... @@ -2102,6 +2102,8 @@
2102 2102 int i;
2103 2103 struct udf_sb_info *sbi;
2104 2104  
  2105 + dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
  2106 +
2105 2107 sbi = UDF_SB(sb);
2106 2108  
2107 2109 lock_kernel();
... ... @@ -1227,6 +1227,8 @@
1227 1227  
1228 1228 UFSD("ENTER\n");
1229 1229  
  1230 + dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
  1231 +
1230 1232 if (sb->s_dirt)
1231 1233 ufs_write_super(sb);
1232 1234  
include/linux/quotaops.h
... ... @@ -156,16 +156,6 @@
156 156 #define sb_dquot_ops (&dquot_operations)
157 157 #define sb_quotactl_ops (&vfs_quotactl_ops)
158 158  
159   -/* Cannot be called inside a transaction */
160   -static inline int vfs_dq_off(struct super_block *sb, int remount)
161   -{
162   - int ret = -ENOSYS;
163   -
164   - if (sb->s_qcop && sb->s_qcop->quota_off)
165   - ret = sb->s_qcop->quota_off(sb, -1, remount);
166   - return ret;
167   -}
168   -
169 159 #else
170 160  
171 161 static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
... ... @@ -230,11 +220,6 @@
230 220  
231 221 static inline void dquot_free_inode(const struct inode *inode)
232 222 {
233   -}
234   -
235   -static inline int vfs_dq_off(struct super_block *sb, int remount)
236   -{
237   - return 0;
238 223 }
239 224  
240 225 static inline int dquot_transfer(struct inode *inode, struct iattr *iattr)