quota: move unmount handling into the filesystem
authorChristoph Hellwig <hch@infradead.org>
Wed, 19 May 2010 11:16:42 +0000 (07:16 -0400)
committerJan Kara <jack@suse.cz>
Mon, 24 May 2010 12:09:12 +0000 (14:09 +0200)
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>
fs/ext2/super.c
fs/ext3/super.c
fs/ext4/super.c
fs/jfs/super.c
fs/reiserfs/super.c
fs/super.c
fs/udf/super.c
fs/ufs/super.c
include/linux/quotaops.h

index 318ebc58bb7b73dcc5230e85c22e88627daefeff..b9b77c3e7ae05f3dd3866a2f4b924647ac58b9ff 100644 (file)
@@ -119,6 +119,8 @@ static void ext2_put_super (struct super_block * sb)
        int i;
        struct ext2_sb_info *sbi = EXT2_SB(sb);
 
+       dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
+
        if (sb->s_dirt)
                ext2_write_super(sb);
 
index 9d5e582b514acf489edd818a1b54040614f45b70..b2f3715988ba3e0e7797e64885b7abf9feba491f 100644 (file)
@@ -410,6 +410,8 @@ static void ext3_put_super (struct super_block * sb)
        struct ext3_super_block *es = sbi->s_es;
        int i, err;
 
+       dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
+
        lock_kernel();
 
        ext3_xattr_put_super(sb);
index 08d31101eb0597d1eeb04235b71f52f8ce5a3cac..808aca3a22f5812054e732f7486d10baedec5a4d 100644 (file)
@@ -645,6 +645,8 @@ static void ext4_put_super(struct super_block *sb)
        struct ext4_super_block *es = sbi->s_es;
        int i, err;
 
+       dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
+
        flush_workqueue(sbi->dio_unwritten_wq);
        destroy_workqueue(sbi->dio_unwritten_wq);
 
index b8a07d4c108e528f898e429d84e0f38e1a4114b7..7d940a3a3d9343b344355e11ff5884849c54e942 100644 (file)
@@ -179,6 +179,8 @@ static void jfs_put_super(struct super_block *sb)
 
        jfs_info("In jfs_put_super");
 
+       dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
+
        lock_kernel();
 
        rc = jfs_umount(sb);
index 5dad5a2707bc3bfd817b0aa39d1bd5dae1ffc565..08879af0af0d54c33f83d94abc362ab190914fe7 100644 (file)
@@ -466,6 +466,8 @@ static void reiserfs_put_super(struct super_block *s)
        struct reiserfs_transaction_handle th;
        th.t_trans_id = 0;
 
+       dquot_disable(s, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
+
        reiserfs_write_lock(s);
 
        if (s->s_dirt)
index a38e6e9b6f690af839c83d54cb5bb13e2a8eb97b..05f62e5d464d99bf88d0777ed6f9396b4ee36b1f 100644 (file)
@@ -160,7 +160,6 @@ void deactivate_locked_super(struct super_block *s)
 {
        struct file_system_type *fs = s->s_type;
        if (atomic_dec_and_test(&s->s_active)) {
-               vfs_dq_off(s, 0);
                fs->kill_sb(s);
                put_filesystem(fs);
                put_super(s);
index b154c41a7a9a8f4fcb3c214a145914efc58a1cf9..76a61566f29957d067a18e32838e5f2f268e56e1 100644 (file)
@@ -2102,6 +2102,8 @@ static void udf_put_super(struct super_block *sb)
        int i;
        struct udf_sb_info *sbi;
 
+       dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
+
        sbi = UDF_SB(sb);
 
        lock_kernel();
index 495fdc1df7eb7c9a6bffcdc73df0c65b8933e5f1..d3977c7128e361ca74a2e7d380499e0e5a5ede6c 100644 (file)
@@ -1227,6 +1227,8 @@ static void ufs_put_super(struct super_block *sb)
                
        UFSD("ENTER\n");
 
+       dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
+
        if (sb->s_dirt)
                ufs_write_super(sb);
 
index 811529241e33a6c4194144a9f1d10d1abbcaa858..cfa2abb1b6d1797d6ee7152912a1f088cf07b785 100644 (file)
@@ -156,16 +156,6 @@ extern const struct quotactl_ops vfs_quotactl_ops;
 #define sb_dquot_ops (&dquot_operations)
 #define sb_quotactl_ops (&vfs_quotactl_ops)
 
-/* Cannot be called inside a transaction */
-static inline int vfs_dq_off(struct super_block *sb, int remount)
-{
-       int ret = -ENOSYS;
-
-       if (sb->s_qcop && sb->s_qcop->quota_off)
-               ret = sb->s_qcop->quota_off(sb, -1, remount);
-       return ret;
-}
-
 #else
 
 static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
@@ -232,11 +222,6 @@ static inline void dquot_free_inode(const struct inode *inode)
 {
 }
 
-static inline int vfs_dq_off(struct super_block *sb, int remount)
-{
-       return 0;
-}
-
 static inline int dquot_transfer(struct inode *inode, struct iattr *iattr)
 {
        return 0;