From fd5472ed44683cf593322a2ef54b9a7675dc780a Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Thu, 26 May 2016 16:10:38 +0200 Subject: ceph: Propagate dentry down to inode_change_ok() To avoid clearing of capabilities or security related extended attributes too early, inode_change_ok() will need to take dentry instead of inode. ceph_setattr() has the dentry easily available but __ceph_setattr() is also called from ceph_set_acl() where dentry is not easily available. Luckily that call path does not need inode_change_ok() to be called anyway. So reorganize functions a bit so that inode_change_ok() is called only from paths where dentry is available. Reviewed-by: Christoph Hellwig Acked-by: Jeff Layton Signed-off-by: Jan Kara --- fs/ceph/acl.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'fs/ceph/acl.c') diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c index d0b6b342dff9..987044bca1c2 100644 --- a/fs/ceph/acl.c +++ b/fs/ceph/acl.c @@ -125,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; -- cgit v1.2.3