Merge tag 'for-linus-4.9-rc2-ofs-1' of git://git.kernel.org/pub/scm/linux/kernel...
[cascardo/linux.git] / fs / ceph / acl.c
index 4f67227..987044b 100644 (file)
@@ -95,11 +95,9 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type)
        case ACL_TYPE_ACCESS:
                name = XATTR_NAME_POSIX_ACL_ACCESS;
                if (acl) {
-                       ret = posix_acl_equiv_mode(acl, &new_mode);
-                       if (ret < 0)
+                       ret = posix_acl_update_mode(inode, &new_mode, &acl);
+                       if (ret)
                                goto out;
-                       if (ret == 0)
-                               acl = NULL;
                }
                break;
        case ACL_TYPE_DEFAULT:
@@ -127,6 +125,11 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type)
                        goto out_free;
        }
 
+       if (ceph_snap(inode) != CEPH_NOSNAP) {
+               ret = -EROFS;
+               goto out_free;
+       }
+
        if (new_mode != old_mode) {
                newattrs.ia_mode = new_mode;
                newattrs.ia_valid = ATTR_MODE;