]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/xfs/xfs_acl.c
Merge tag 'xfs-5.4-merge-8' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
[linux.git] / fs / xfs / xfs_acl.c
index cbda40d40326683236022c3a30b976a72ba257ee..96d7071cfa4689435aeaf2ed34a7d58bb3e7bc2c 100644 (file)
@@ -112,7 +112,7 @@ xfs_get_acl(struct inode *inode, int type)
 {
        struct xfs_inode *ip = XFS_I(inode);
        struct posix_acl *acl = NULL;
-       struct xfs_acl *xfs_acl;
+       struct xfs_acl *xfs_acl = NULL;
        unsigned char *ea_name;
        int error;
        int len;
@@ -135,12 +135,8 @@ xfs_get_acl(struct inode *inode, int type)
         * go out to the disk.
         */
        len = XFS_ACL_MAX_SIZE(ip->i_mount);
-       xfs_acl = kmem_zalloc_large(len, KM_SLEEP);
-       if (!xfs_acl)
-               return ERR_PTR(-ENOMEM);
-
-       error = xfs_attr_get(ip, ea_name, (unsigned char *)xfs_acl,
-                                                       &len, ATTR_ROOT);
+       error = xfs_attr_get(ip, ea_name, (unsigned char **)&xfs_acl, &len,
+                               ATTR_ALLOC | ATTR_ROOT);
        if (error) {
                /*
                 * If the attribute doesn't exist make sure we have a negative
@@ -151,8 +147,8 @@ xfs_get_acl(struct inode *inode, int type)
        } else  {
                acl = xfs_acl_from_disk(xfs_acl, len,
                                        XFS_ACL_MAX_ENTRIES(ip->i_mount));
+               kmem_free(xfs_acl);
        }
-       kmem_free(xfs_acl);
        return acl;
 }
 
@@ -180,7 +176,7 @@ __xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
                struct xfs_acl *xfs_acl;
                int len = XFS_ACL_MAX_SIZE(ip->i_mount);
 
-               xfs_acl = kmem_zalloc_large(len, KM_SLEEP);
+               xfs_acl = kmem_zalloc_large(len, 0);
                if (!xfs_acl)
                        return -ENOMEM;