Merge branch 'for-2.6.31' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
[firefly-linux-kernel-4.4.55.git] / fs / ext3 / acl.c
index d81ef2fdb08e0aeca8e533963db7f7feeecbd386..e0c7454517158dde2ee69433526c78eeb5398cd2 100644 (file)
@@ -129,12 +129,15 @@ fail:
 static inline struct posix_acl *
 ext3_iget_acl(struct inode *inode, struct posix_acl **i_acl)
 {
-       struct posix_acl *acl = EXT3_ACL_NOT_CACHED;
+       struct posix_acl *acl = ACCESS_ONCE(*i_acl);
 
-       spin_lock(&inode->i_lock);
-       if (*i_acl != EXT3_ACL_NOT_CACHED)
-               acl = posix_acl_dup(*i_acl);
-       spin_unlock(&inode->i_lock);
+       if (acl) {
+               spin_lock(&inode->i_lock);
+               acl = *i_acl;
+               if (acl != EXT3_ACL_NOT_CACHED)
+                       acl = posix_acl_dup(acl);
+               spin_unlock(&inode->i_lock);
+       }
 
        return acl;
 }