Btrfs: deal with NULL srv_rsv in the delalloc inode reservation code
[pandora-kernel.git] / fs / btrfs / acl.c
index 4cc5c01..89b156d 100644 (file)
@@ -28,8 +28,6 @@
 #include "btrfs_inode.h"
 #include "xattr.h"
 
-#ifdef CONFIG_BTRFS_FS_POSIX_ACL
-
 struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
 {
        int size;
@@ -61,22 +59,19 @@ struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
                if (!value)
                        return ERR_PTR(-ENOMEM);
                size = __btrfs_getxattr(inode, name, value, size);
-               if (size > 0) {
-                       acl = posix_acl_from_xattr(value, size);
-                       if (IS_ERR(acl)) {
-                               kfree(value);
-                               return acl;
-                       }
-                       set_cached_acl(inode, type, acl);
-               }
-               kfree(value);
+       }
+       if (size > 0) {
+               acl = posix_acl_from_xattr(value, size);
        } else if (size == -ENOENT || size == -ENODATA || size == 0) {
                /* FIXME, who returns -ENOENT?  I think nobody */
                acl = NULL;
-               set_cached_acl(inode, type, acl);
        } else {
                acl = ERR_PTR(-EIO);
        }
+       kfree(value);
+
+       if (!IS_ERR(acl))
+               set_cached_acl(inode, type, acl);
 
        return acl;
 }
@@ -276,18 +271,3 @@ const struct xattr_handler btrfs_xattr_acl_access_handler = {
        .get    = btrfs_xattr_acl_get,
        .set    = btrfs_xattr_acl_set,
 };
-
-#else /* CONFIG_BTRFS_FS_POSIX_ACL */
-
-int btrfs_acl_chmod(struct inode *inode)
-{
-       return 0;
-}
-
-int btrfs_init_acl(struct btrfs_trans_handle *trans,
-                  struct inode *inode, struct inode *dir)
-{
-       return 0;
-}
-
-#endif /* CONFIG_BTRFS_FS_POSIX_ACL */