Re: [PATCH 3/5] fs/ntfs3: Pass flags to ntfs_set_ea in ntfs_set_acl_ex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 22, 2021 at 07:19:19PM +0300, Konstantin Komarov wrote:
> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@xxxxxxxxxxxxxxxxxxxx>

Please tell why we need to pass flags to ntfs_set_ea(). Commit message
is for why we do something. It does not have to have example have any
info what we did. Code will tell that.

> ---
>  fs/ntfs3/xattr.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
> index 3795943efc8e..70f2f9eb6b1e 100644
> --- a/fs/ntfs3/xattr.c
> +++ b/fs/ntfs3/xattr.c
> @@ -549,6 +549,7 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
>  	size_t size, name_len;
>  	void *value = NULL;
>  	int err = 0;
> +	int flags;
>  
>  	if (S_ISLNK(inode->i_mode))
>  		return -EOPNOTSUPP;
> @@ -591,20 +592,24 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
>  	}
>  
>  	if (!acl) {
> +		/* Remove xattr if it can be presented via mode. */
>  		size = 0;
>  		value = NULL;
> +		flags = XATTR_REPLACE;
>  	} else {
>  		size = posix_acl_xattr_size(acl->a_count);
>  		value = kmalloc(size, GFP_NOFS);
>  		if (!value)
>  			return -ENOMEM;
> -
>  		err = posix_acl_to_xattr(mnt_userns, acl, value, size);
>  		if (err < 0)
>  			goto out;
> +		flags = 0;
>  	}
>  
> -	err = ntfs_set_ea(inode, name, name_len, value, size, 0, locked);
> +	err = ntfs_set_ea(inode, name, name_len, value, size, flags, locked);
> +	if (err == -ENODATA && !size)
> +		err = 0; /* Removing non existed xattr. */
>  	if (!err)
>  		set_cached_acl(inode, type, acl);
>  
> -- 
> 2.33.0
> 
> 
> 



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux