From: Jan Kara Subject: Re: [PATCH 2/5] ceph: Propagate dentry down to inode_change_ok() Date: Thu, 22 Sep 2016 10:50:01 +0200 Message-ID: <20160922085001.GG2834@quack2.suse.cz> References: <1474299059-14806-1-git-send-email-jack@suse.cz> <1474299059-14806-3-git-send-email-jack@suse.cz> <1474311422.5754.39.camel@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Return-path: Received: from mx2.suse.de ([195.135.220.15]:58930 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755629AbcIVIvN (ORCPT ); Thu, 22 Sep 2016 04:51:13 -0400 Content-Disposition: inline In-Reply-To: <1474311422.5754.39.camel@redhat.com> Sender: ceph-devel-owner@vger.kernel.org List-ID: To: Jeff Layton Cc: Jan Kara , Al Viro , Andrew Morton , linux-fsdevel@vger.kernel.org, xfs@oss.sgi.org, Dave Chinner , Ilya Dryomov , Sage Weil , "Yan, Zheng" , ceph-devel@vger.kernel.org, Miklos Szeredi On Mon 19-09-16 14:57:02, Jeff Layton wrote: > On Mon, 2016-09-19 at 17:30 +0200, Jan Kara wrote: > > 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. > > > > > Signed-off-by: Jan Kara > > --- > >  fs/ceph/acl.c   |  5 +++++ > >  fs/ceph/inode.c | 19 +++++++++++-------- > >  2 files changed, 16 insertions(+), 8 deletions(-) > > > > diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c > > index 013151d50069..a2cedfde75eb 100644 > > --- a/fs/ceph/acl.c > > +++ b/fs/ceph/acl.c > > @@ -127,6 +127,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; > > > + } > > + > > So to make sure I understand: What's the expected behavior when someone > changes the ACL in such a way that the mode gets changed? Should > security_inode_killpriv be getting called in that case? If so, where > does that happen, as I don't see notify_change being called in this > codepath? No. security_inode_killpriv() is supposed to be called when either contents of the file changes (truncate, write) or when owner of the file changes. It is not called for permission changes. ... > Looks reasonable though: > > Acked-by: Jeff Layton Thanks for review! Honza -- Jan Kara SUSE Labs, CR