]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/orangefs/acl.c
Merge branch 'for-linus-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml
[linux.git] / fs / orangefs / acl.c
index 9409aac232f71379b1f62db20697d9fa9aa8defd..9108ef433e6d7b09721360a4dc3c1e7f4f2caf3b 100644 (file)
@@ -35,7 +35,7 @@ struct posix_acl *orangefs_get_acl(struct inode *inode, int type)
         * I don't do that for now.
         */
        value = kmalloc(ORANGEFS_MAX_XATTR_VALUELEN, GFP_KERNEL);
-       if (value == NULL)
+       if (!value)
                return ERR_PTR(-ENOMEM);
 
        gossip_debug(GOSSIP_ACL_DEBUG,
@@ -119,11 +119,18 @@ static int __orangefs_set_acl(struct inode *inode, struct posix_acl *acl,
 int orangefs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
 {
        int error;
+       struct iattr iattr;
+       int rc;
 
        if (type == ACL_TYPE_ACCESS && acl) {
-               umode_t mode;
-
-               error = posix_acl_update_mode(inode, &mode, &acl);
+               /*
+                * posix_acl_update_mode checks to see if the permissions
+                * described by the ACL can be encoded into the
+                * object's mode. If so, it sets "acl" to NULL
+                * and "mode" to the new desired value. It is up to
+                * us to propagate the new mode back to the server...
+                */
+               error = posix_acl_update_mode(inode, &iattr.ia_mode, &acl);
                if (error) {
                        gossip_err("%s: posix_acl_update_mode err: %d\n",
                                   __func__,
@@ -131,12 +138,18 @@ int orangefs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
                        return error;
                }
 
-               if (inode->i_mode != mode)
-                       SetModeFlag(ORANGEFS_I(inode));
-               inode->i_mode = mode;
-               mark_inode_dirty_sync(inode);
+               if (acl) {
+                       rc = __orangefs_set_acl(inode, acl, type);
+               } else {
+                       iattr.ia_valid = ATTR_MODE;
+                       rc = orangefs_inode_setattr(inode, &iattr);
+               }
+
+               return rc;
+
+       } else {
+               return -EINVAL;
        }
-       return __orangefs_set_acl(inode, acl, type);
 }
 
 int orangefs_init_acl(struct inode *inode, struct inode *dir)