generic_acl: no need to clone acl just to push it to set_cached_acl()
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 23 Jul 2011 06:41:54 +0000 (02:41 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 25 Jul 2011 18:27:31 +0000 (14:27 -0400)
In-core acls are copy-on-write, so the reference taken by set_cached_acl() will
do just fine.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/generic_acl.c

index 3a60d9d1653c42000f8775f280238a0f4d9117c4..134782116a62a751fd68094b05542faf53519eec 100644 (file)
@@ -134,14 +134,8 @@ generic_acl_init(struct inode *inode, struct inode *dir)
        if (acl) {
                struct posix_acl *clone;
 
-               if (S_ISDIR(inode->i_mode)) {
-                       clone = posix_acl_clone(acl, GFP_KERNEL);
-                       error = -ENOMEM;
-                       if (!clone)
-                               goto cleanup;
-                       set_cached_acl(inode, ACL_TYPE_DEFAULT, clone);
-                       posix_acl_release(clone);
-               }
+               if (S_ISDIR(inode->i_mode))
+                       set_cached_acl(inode, ACL_TYPE_DEFAULT, acl);
                clone = posix_acl_clone(acl, GFP_KERNEL);
                error = -ENOMEM;
                if (!clone)