There is a bug in the CKRM CPU scheduler. This has been reported to the
[linux-2.6.git] / fs / ext2 / xattr.c
index abefa1c..ab8308a 100644 (file)
@@ -57,6 +57,7 @@
 #include <linux/mbcache.h>
 #include <linux/quotaops.h>
 #include <linux/rwsem.h>
+#include <linux/vs_dlimit.h>
 #include "ext2.h"
 #include "xattr.h"
 #include "acl.h"
@@ -749,8 +750,12 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
                                   the inode.  */
                                ea_bdebug(new_bh, "reusing block");
 
+                               error = -ENOSPC;
+                               if (DLIMIT_ALLOC_BLOCK(sb, inode->i_xid, 1))
+                                       goto cleanup;
                                error = -EDQUOT;
                                if (DQUOT_ALLOC_BLOCK(inode, 1)) {
+                                       DLIMIT_FREE_BLOCK(sb, inode->i_xid, 1);
                                        unlock_buffer(new_bh);
                                        goto cleanup;
                                }
@@ -772,7 +777,8 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
                                                           s_first_data_block) +
                                   EXT2_I(inode)->i_block_group *
                                   EXT2_BLOCKS_PER_GROUP(sb);
-                       int block = ext2_new_block(inode, goal, 0, 0, &error);
+                       int block = ext2_new_block(inode, goal,
+                                                  NULL, NULL, &error);
                        if (error)
                                goto cleanup;
                        ea_idebug(inode, "creating block %d", block);
@@ -829,6 +835,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
                        /* Decrement the refcount only. */
                        HDR(old_bh)->h_refcount = cpu_to_le32(
                                le32_to_cpu(HDR(old_bh)->h_refcount) - 1);
+                       DLIMIT_FREE_BLOCK(sb, inode->i_xid, 1);
                        DQUOT_FREE_BLOCK(inode, 1);
                        mark_buffer_dirty(old_bh);
                        ea_bdebug(old_bh, "refcount now=%d",
@@ -884,6 +891,7 @@ ext2_xattr_delete_inode(struct inode *inode)
                mark_buffer_dirty(bh);
                if (IS_SYNC(inode))
                        sync_dirty_buffer(bh);
+               DLIMIT_FREE_BLOCK(inode->i_sb, inode->i_xid, 1);
                DQUOT_FREE_BLOCK(inode, 1);
        }
        ea_bdebug(bh, "refcount now=%d", le32_to_cpu(HDR(bh)->h_refcount) - 1);