]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/reiserfs/xattr_acl.c
Pull acpi_bus_register_driver into release branch
[linux-2.6-omap-h63xx.git] / fs / reiserfs / xattr_acl.c
index a47ac9aac8b2b743c8768091abacdeff0e14ee2c..97ae1b92bc47d0088a10ff3b1bc6433a70f05bda 100644 (file)
@@ -1,3 +1,4 @@
+#include <linux/capability.h>
 #include <linux/fs.h>
 #include <linux/posix_acl.h>
 #include <linux/reiserfs_fs.h>
@@ -174,14 +175,14 @@ static void *posix_acl_to_disk(const struct posix_acl *acl, size_t * size)
 /*
  * Inode operation get_posix_acl().
  *
- * inode->i_sem: down
+ * inode->i_mutex: down
  * BKL held [before 2.5.x]
  */
 struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
 {
        char *name, *value;
        struct posix_acl *acl, **p_acl;
-       size_t size;
+       int size;
        int retval;
        struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
 
@@ -205,7 +206,7 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
                return posix_acl_dup(*p_acl);
 
        size = reiserfs_xattr_get(inode, name, NULL, 0);
-       if ((int)size < 0) {
+       if (size < 0) {
                if (size == -ENODATA || size == -ENOSYS) {
                        *p_acl = ERR_PTR(-ENODATA);
                        return NULL;
@@ -227,7 +228,8 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
                acl = ERR_PTR(retval);
        } else {
                acl = posix_acl_from_disk(value, retval);
-               *p_acl = posix_acl_dup(acl);
+               if (!IS_ERR(acl))
+                       *p_acl = posix_acl_dup(acl);
        }
 
        kfree(value);
@@ -237,7 +239,7 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
 /*
  * Inode operation set_posix_acl().
  *
- * inode->i_sem: down
+ * inode->i_mutex: down
  * BKL held [before 2.5.x]
  */
 static int
@@ -312,7 +314,7 @@ reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
        return error;
 }
 
-/* dir->i_sem: down,
+/* dir->i_mutex: locked,
  * inode is new and not released into the wild yet */
 int
 reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry,
@@ -406,8 +408,9 @@ int reiserfs_cache_default_acl(struct inode *inode)
                acl = reiserfs_get_acl(inode, ACL_TYPE_DEFAULT);
                reiserfs_read_unlock_xattrs(inode->i_sb);
                reiserfs_read_unlock_xattr_i(inode);
-               ret = acl ? 1 : 0;
-               posix_acl_release(acl);
+               ret = (acl && !IS_ERR(acl));
+               if (ret)
+                       posix_acl_release(acl);
        }
 
        return ret;