From: Steven Whitehouse Date: Fri, 6 Oct 2017 10:05:14 +0100 Subject: [Cluster-devel] [PATCH] gfs2: Remove incorrect permission check in gfs2_setattr In-Reply-To: <20171005221159.27255-1-agruenba@redhat.com> References: <20171005221159.27255-1-agruenba@redhat.com> Message-ID: <56646e7f-d2eb-b00c-309a-66884bb63b37@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, On 05/10/17 23:11, Andreas Gruenbacher wrote: > Function notify_change already performs the necessary permission checks Does it do that under the glock? If not then it is racey which is probably why the second check was added, Steve. > for immutable and append-only files, so there is no need to check again > in setattr inode operations. What's worse, the check in gfs2_setattr > prevents setting the atime and mtime of append-only files to the current > time, which is supposed to be permitted. > > Fixes xfstest generic/079. > > Signed-off-by: Andreas Gruenbacher > --- > fs/gfs2/inode.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c > index 4749a6b8e4dd..05284dd2ae6c 100644 > --- a/fs/gfs2/inode.c > +++ b/fs/gfs2/inode.c > @@ -1940,10 +1940,6 @@ static int gfs2_setattr(struct dentry *dentry, struct iattr *attr) > if (error) > return error; > > - error = -EPERM; > - if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) > - goto out; > - > error = setattr_prepare(dentry, attr); > if (error) > goto out;