Whamcloud - gitweb
LU-11450 mdd: avoid logging trusted.som xattr in changelogs 23/33323/5
authorQian Yingjin <qian@ddn.com>
Tue, 9 Oct 2018 07:41:59 +0000 (15:41 +0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 29 Oct 2018 15:57:51 +0000 (15:57 +0000)
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 <qian@ddn.com>
Change-Id: I8f069afdfa84a8fc9f96819d066fd3e4d08794af
Reviewed-on: https://review.whamcloud.com/33323
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/mdd/mdd_object.c
lustre/tests/sanity.sh

index 61eaa8b..e7d6fa4 100644 (file)
@@ -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 */
index 2d28256..3fedd2d 100644 (file)
@@ -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,
index 6dd2c7c..b105d40 100755 (executable)
@@ -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
 #