import PULS_20180308
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / fs / 9p / acl.c
index 7af425f53beef91a6d21dc86b76e161ff7ed1696..142180cd805531987812088630111a88416724a5 100644 (file)
@@ -320,32 +320,26 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name,
        case ACL_TYPE_ACCESS:
                name = POSIX_ACL_XATTR_ACCESS;
                if (acl) {
-                       umode_t mode = inode->i_mode;
-                       retval = posix_acl_equiv_mode(acl, &mode);
-                       if (retval < 0)
+                       struct iattr iattr;
+
+                       retval = posix_acl_update_mode(inode, &iattr.ia_mode, &acl);
+                       if (retval)
                                goto err_out;
-                       else {
-                               struct iattr iattr;
-                               if (retval == 0) {
-                                       /*
-                                        * ACL can be represented
-                                        * by the mode bits. So don't
-                                        * update ACL.
-                                        */
-                                       acl = NULL;
-                                       value = NULL;
-                                       size = 0;
-                               }
-                               /* Updte the mode bits */
-                               iattr.ia_mode = ((mode & S_IALLUGO) |
-                                                (inode->i_mode & ~S_IALLUGO));
+                       if (!acl) {
+                               /*
+                                * ACL can be represented
+                                * by the mode bits. So don't
+                                * update ACL.
+                                */
+                               value = NULL;
+                               size = 0;
+                       }
                                iattr.ia_valid = ATTR_MODE;
                                /* FIXME should we update ctime ?
                                 * What is the following setxattr update the
                                 * mode ?
                                 */
                                v9fs_vfs_setattr_dotl(dentry, &iattr);
-                       }
                }
                break;
        case ACL_TYPE_DEFAULT: