]> err.no Git - linux-2.6/blobdiff - fs/reiserfs/super.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx
[linux-2.6] / fs / reiserfs / super.c
index f8f9a473e6704374786459f0066d40e569c15323..1d40f2bd197081284dce1ff34c6d1f828082304f 100644 (file)
@@ -1890,8 +1890,14 @@ static int reiserfs_dquot_drop(struct inode *inode)
        ret =
            journal_begin(&th, inode->i_sb,
                          2 * REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb));
-       if (ret)
+       if (ret) {
+               /*
+                * We call dquot_drop() anyway to at least release references
+                * to quota structures so that umount does not hang.
+                */
+               dquot_drop(inode);
                goto out;
+       }
        ret = dquot_drop(inode);
        err =
            journal_end(&th, inode->i_sb,
@@ -2019,6 +2025,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
 {
        int err;
        struct nameidata nd;
+       struct inode *inode;
 
        if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA)))
                return -EINVAL;
@@ -2033,12 +2040,18 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
                path_put(&nd.path);
                return -EXDEV;
        }
+       inode = nd.path.dentry->d_inode;
        /* We must not pack tails for quota files on reiserfs for quota IO to work */
-       if (!(REISERFS_I(nd.path.dentry->d_inode)->i_flags & i_nopack_mask)) {
-               reiserfs_warning(sb,
-                                "reiserfs: Quota file must have tail packing disabled.");
-               path_put(&nd.path);
-               return -EINVAL;
+       if (!(REISERFS_I(inode)->i_flags & i_nopack_mask)) {
+               err = reiserfs_unpack(inode, NULL);
+               if (err) {
+                       reiserfs_warning(sb,
+                               "reiserfs: Unpacking tail of quota file failed"
+                               " (%d). Cannot turn on quotas.", err);
+                       path_put(&nd.path);
+                       return -EINVAL;
+               }
+               mark_inode_dirty(inode);
        }
        /* Not journalling quota? No more tests needed... */
        if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] &&
@@ -2152,8 +2165,10 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type,
                blk++;
        }
 out:
-       if (len == towrite)
+       if (len == towrite) {
+               mutex_unlock(&inode->i_mutex);
                return err;
+       }
        if (inode->i_size < off + len - towrite)
                i_size_write(inode, off + len - towrite);
        inode->i_version++;