[Cluster-devel] [PATCH] gfs2: Remove incorrect permission check in gfs2_setattr

Steven Whitehouse swhiteho at redhat.com
Fri Oct 6 09:05:14 UTC 2017


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 <agruenba at redhat.com>
> ---
>   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;




More information about the Cluster-devel mailing list