[Devel] [PATCH] pfcache: silently drop "trusted.pfcache" xattr when set on inappropriate fs

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Fri Jan 18 15:11:14 MSK 2019



On 1/16/19 7:24 PM, Konstantin Khorenko wrote:
> Currently we deny setting "trusted.pfcache" xattr on a fs mounted
> without "pfcache_csum" mount flag, returning error.
> 
> But there is a usecase when people mount a Container snapshot
> and rsync data from it (to some usual fs without "pfcache_csum" flag).
> "rsync -X" detects "trusted.pfcache" xattr on source file, tries to set
> it on destination file and fails.
> 
> Let's workaround it by silently dropping "trusted.pfcache" xattr when
> set on a fs without "pfcache_csum".
> 
> https://jira.sw.ru/browse/PSBM-90740
> 
> Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>

Reviewed-by: Tikhomirov Pavel <ptikhomirov at virtuozzo.com>

> ---
>   fs/ext4/pfcache.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/pfcache.c b/fs/ext4/pfcache.c
> index 792f75960b30..eb3950b50088 100644
> --- a/fs/ext4/pfcache.c
> +++ b/fs/ext4/pfcache.c
> @@ -702,8 +702,12 @@ static int ext4_xattr_trusted_csum_set(struct dentry *dentry, const char *name,
>   	if (strcmp(name, ""))
>   		return -ENODATA;
>   
> +	/*
> +	 * Silently drop "trusted.pfcache" xattr, useful for the case when
> +	 * a file with csum is copied to non-pfcache-enabled fs.
> +	 */
>   	if (!test_opt2(inode->i_sb, PFCACHE_CSUM))
> -		return -EOPNOTSUPP;
> +		return 0;
>   
>   	if (!capable(CAP_SYS_ADMIN))
>   		return -EPERM;
> 

-- 
Best regards, Tikhomirov Pavel
Software Developer, Virtuozzo.



More information about the Devel mailing list