Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / fs / ext2 / xattr.c
index 6069204..24c816a 100644 (file)
@@ -326,7 +326,7 @@ cleanup:
 /*
  * Inode operation listxattr()
  *
- * dentry->d_inode->i_sem: don't care
+ * dentry->d_inode->i_mutex: don't care
  */
 ssize_t
 ext2_listxattr(struct dentry *dentry, char *buffer, size_t size)
@@ -390,10 +390,6 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
        ea_idebug(inode, "name=%d.%s, value=%p, value_len=%ld",
                  name_index, name, value, (long)value_len);
 
-       if (IS_RDONLY(inode))
-               return -EROFS;
-       if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
-               return -EPERM;
        if (value == NULL)
                value_len = 0;
        if (name == NULL)
@@ -651,11 +647,11 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
                                ea_bdebug(new_bh, "reusing block");
 
                                error = -ENOSPC;
-                               if (DLIMIT_ALLOC_BLOCK(sb, inode->i_xid, 1))
+                               if (DLIMIT_ALLOC_BLOCK(inode, 1))
                                        goto cleanup;
                                error = -EDQUOT;
                                if (DQUOT_ALLOC_BLOCK(inode, 1)) {
-                                       DLIMIT_FREE_BLOCK(sb, inode->i_xid, 1);
+                                       DLIMIT_FREE_BLOCK(inode, 1);
                                        unlock_buffer(new_bh);
                                        goto cleanup;
                                }
@@ -749,7 +745,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
                                le32_to_cpu(HDR(old_bh)->h_refcount) - 1);
                        if (ce)
                                mb_cache_entry_release(ce);
-                       DLIMIT_FREE_BLOCK(sb, inode->i_xid, 1);
+                       DLIMIT_FREE_BLOCK(inode, 1);
                        DQUOT_FREE_BLOCK(inode, 1);
                        mark_buffer_dirty(old_bh);
                        ea_bdebug(old_bh, "refcount now=%d",
@@ -802,19 +798,21 @@ ext2_xattr_delete_inode(struct inode *inode)
                ext2_free_blocks(inode, EXT2_I(inode)->i_file_acl, 1);
                get_bh(bh);
                bforget(bh);
+               unlock_buffer(bh);
        } else {
                HDR(bh)->h_refcount = cpu_to_le32(
                        le32_to_cpu(HDR(bh)->h_refcount) - 1);
                if (ce)
                        mb_cache_entry_release(ce);
+               ea_bdebug(bh, "refcount now=%d",
+                       le32_to_cpu(HDR(bh)->h_refcount));
+               unlock_buffer(bh);
                mark_buffer_dirty(bh);
                if (IS_SYNC(inode))
                        sync_dirty_buffer(bh);
-               DLIMIT_FREE_BLOCK(inode->i_sb, inode->i_xid, 1);
+               DLIMIT_FREE_BLOCK(inode, 1);
                DQUOT_FREE_BLOCK(inode, 1);
        }
-       ea_bdebug(bh, "refcount now=%d", le32_to_cpu(HDR(bh)->h_refcount) - 1);
-       unlock_buffer(bh);
        EXT2_I(inode)->i_file_acl = 0;
 
 cleanup:
@@ -830,7 +828,7 @@ cleanup:
 void
 ext2_xattr_put_super(struct super_block *sb)
 {
-       mb_cache_shrink(ext2_xattr_cache, sb->s_bdev);
+       mb_cache_shrink(sb->s_bdev);
 }