summaryrefslogtreecommitdiff
path: root/fs/ceph/acl.c
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@gmx.com>2018-09-02 18:21:09 +0300
committerIlya Dryomov <idryomov@gmail.com>2018-10-22 11:28:20 +0300
commit5da207993e396f445d813338dd3540ddd6d26816 (patch)
treeb2ce4341e636b29e7b76e979f432a550446369f2 /fs/ceph/acl.c
parent7d8dc53414c5770afb8b83db096ecab0cd53ec93 (diff)
downloadlinux-5da207993e396f445d813338dd3540ddd6d26816.tar.xz
ceph: check snap first in ceph_set_acl()
Do the snap check first in ceph_set_acl(), so we can avoid unnecessary operations when the inode has snap. Signed-off-by: Chengguang Xu <cgxu519@gmx.com> Reviewed-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/acl.c')
-rw-r--r--fs/ceph/acl.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c
index 027408d55aee..8a9b562ae4ca 100644
--- a/fs/ceph/acl.c
+++ b/fs/ceph/acl.c
@@ -104,6 +104,11 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type)
struct timespec64 old_ctime = inode->i_ctime;
umode_t new_mode = inode->i_mode, old_mode = inode->i_mode;
+ if (ceph_snap(inode) != CEPH_NOSNAP) {
+ ret = -EROFS;
+ goto out;
+ }
+
switch (type) {
case ACL_TYPE_ACCESS:
name = XATTR_NAME_POSIX_ACL_ACCESS;
@@ -138,11 +143,6 @@ 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_ctime = current_time(inode);
newattrs.ia_mode = new_mode;