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

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jan 16 19:24:55 MSK 2019


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>
---
 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;
-- 
2.15.1



More information about the Devel mailing list