From: Qian Yingjin Date: Tue, 9 Oct 2018 07:41:59 +0000 (+0800) Subject: LU-11450 mdd: avoid logging trusted.som xattr in changelogs X-Git-Tag: 2.12.0-RC1~157 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=faf6f514c172d6949e474c17f95ac45634b063fb LU-11450 mdd: avoid logging trusted.som xattr in changelogs The Lazy Size on MDT is causing the trusted.som xattr to be logged in the changelog whenever a file is needed to update this xattr data casued by file open/close or truncate operations. This patch fixes this problem to avoid logging this xattr for every file. Signed-off-by: Qian Yingjin Change-Id: I8f069afdfa84a8fc9f96819d066fd3e4d08794af Reviewed-on: https://review.whamcloud.com/33323 Tested-by: Jenkins Reviewed-by: Andreas Dilger Reviewed-by: Wang Shilong Reviewed-by: John L. Hammond Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/uapi/linux/lustre/lustre_user.h b/lustre/include/uapi/linux/lustre/lustre_user.h index 61eaa8b..e7d6fa4 100644 --- a/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/lustre/include/uapi/linux/lustre/lustre_user.h @@ -1087,6 +1087,7 @@ enum la_valid { /********* Changelogs **********/ /** Changelog record types */ enum changelog_rec_type { + CL_NONE = -1, CL_MARK = 0, CL_CREATE = 1, /* namespace */ CL_MKDIR = 2, /* namespace */ diff --git a/lustre/mdd/mdd_object.c b/lustre/mdd/mdd_object.c index 2d282563..3fedd2d 100644 --- a/lustre/mdd/mdd_object.c +++ b/lustre/mdd/mdd_object.c @@ -1325,6 +1325,10 @@ mdd_xattr_changelog_type(const struct lu_env *env, struct mdd_device *mdd, if (strcmp(XATTR_NAME_HSM, xattr_name) == 0) return CL_HSM; + /* Avoid logging SOM xattr for every file */ + if (strcmp(XATTR_NAME_SOM, xattr_name) == 0) + return CL_NONE; + if (has_prefix(xattr_name, XATTR_USER_PREFIX) || has_prefix(xattr_name, XATTR_NAME_POSIX_ACL_ACCESS) || has_prefix(xattr_name, XATTR_NAME_POSIX_ACL_DEFAULT) || @@ -1332,7 +1336,7 @@ mdd_xattr_changelog_type(const struct lu_env *env, struct mdd_device *mdd, has_prefix(xattr_name, XATTR_SECURITY_PREFIX)) return CL_SETXATTR; - return -1; + return CL_NONE; } static int mdd_declare_xattr_set(const struct lu_env *env, diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 6dd2c7c..b105d40 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -19808,6 +19808,38 @@ test_807() { } run_test 807 "verify LSOM syncing tool" +check_som_nologged() +{ + local lines=$($LFS changelog $FSNAME-MDT0000 | + grep 'x=trusted.som' | wc -l) + [ $lines -ne 0 ] && error "trusted.som xattr is logged in Changelogs" +} + +test_808() { + [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.11.55) ] && + skip "Need MDS version at least 2.11.55" && return + + # Registration step + changelog_register || error "changelog_register failed" + + touch $DIR/$tfile || error "touch $tfile failed" + check_som_nologged + + dd if=/dev/zero of=$DIR/$tfile bs=1048576 count=1 || + error "write $tfile failed" + check_som_nologged + + $TRUNCATE $DIR/$tfile 1234 + check_som_nologged + + $TRUNCATE $DIR/$tfile 1048576 + check_som_nologged + + # Deregistration step + changelog_deregister || error "changelog_deregister failed" +} +run_test 808 "Check trusted.som xattr not logged in Changelogs" + # # tests that do cleanup/setup should be run at the end #