]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/ufs/super.c
quota: move unmount handling into the filesystem
[net-next-2.6.git] / fs / ufs / super.c
index 14743d935a93f88a41691d122cc7f353fe102b17..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);
 
@@ -1248,7 +1250,9 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
        struct ufs_super_block_first * usb1;
        struct ufs_super_block_third * usb3;
        unsigned new_mount_opt, ufstype;
+       int enable_quota = 0;
        unsigned flags;
+       int err;
 
        lock_kernel();
        lock_super(sb);
@@ -1289,6 +1293,13 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
         * fs was mouted as rw, remounting ro
         */
        if (*mount_flags & MS_RDONLY) {
+               err = dquot_suspend(sb, -1);
+               if (err < 0) {
+                       unlock_super(sb);
+                       unlock_kernel();
+                       return err;
+               }
+
                ufs_put_super_internal(sb);
                usb1->fs_time = cpu_to_fs32(sb, get_seconds());
                if ((flags & UFS_ST_MASK) == UFS_ST_SUN
@@ -1327,11 +1338,14 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
                        return -EPERM;
                }
                sb->s_flags &= ~MS_RDONLY;
+               enable_quota = 1;
 #endif
        }
        UFS_SB(sb)->s_mount_opt = new_mount_opt;
        unlock_super(sb);
        unlock_kernel();
+       if (enable_quota)
+               dquot_resume(sb, -1);
        return 0;
 }