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

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jan 18 15:36:07 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.1.3.vz7.83.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.1.3.vz7.83.7
------>
commit cd3677781bc31e63a4b0c705eb8378b76331259e
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Wed Jan 16 19:09:49 2019 +0300

    pfcache: silently drop "trusted.pfcache" xattr when set on inappropriate fs
    
    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: Pavel Tikhomirov <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;



More information about the Devel mailing list