Whamcloud - gitweb
LU-11695 som: disabling xattr cache for LSOM on client 11/33711/3
authorQian Yingjin <qian@ddn.com>
Fri, 23 Nov 2018 08:10:54 +0000 (16:10 +0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 11 Jul 2022 06:48:53 +0000 (06:48 +0000)
To obtain uptodate LSOM data, currently a client needs to set
llite.*.xattr_cache =0 to disable the xattr cache on client
completely. This leads that other kinds of xattr can not be cached
on the client too.
This patch introduces a heavy-weight solution to disable caching
only for LSOM xattr data ("trusted.som") on client.

Signed-off-by: Qian Yingjin <qian@ddn.com>
Change-Id: Iab5ef3030b05ac09184d01f2a3a8ed92ff1cf26b
Reviewed-on: https://review.whamcloud.com/33711
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/xattr.c
lustre/llite/xattr_cache.c
lustre/tests/sanity.sh

index 1651d6b..27157ba 100644 (file)
@@ -398,7 +398,8 @@ int ll_xattr_list(struct inode *inode, const char *name, int type, void *buffer,
                GOTO(out_xattr, rc = -EPERM);
 
        if (sbi->ll_xattr_cache_enabled && type != XATTR_ACL_ACCESS_T &&
                GOTO(out_xattr, rc = -EPERM);
 
        if (sbi->ll_xattr_cache_enabled && type != XATTR_ACL_ACCESS_T &&
-           (type != XATTR_SECURITY_T || strcmp(name, "security.selinux"))) {
+           (type != XATTR_SECURITY_T || strcmp(name, "security.selinux")) &&
+           (type != XATTR_TRUSTED_T || strcmp(name, XATTR_NAME_SOM))) {
                rc = ll_xattr_cache_get(inode, name, buffer, size, valid);
                if (rc == -EAGAIN)
                        goto getxattr_nocache;
                rc = ll_xattr_cache_get(inode, name, buffer, size, valid);
                if (rc == -EAGAIN)
                        goto getxattr_nocache;
index ce3e3a7..9de6b6d 100644 (file)
@@ -509,6 +509,10 @@ static int ll_xattr_cache_refill(struct inode *inode)
                        /* Filter out security.selinux, it is cached in slab */
                        CDEBUG(D_CACHE, "not caching security.selinux\n");
                        rc = 0;
                        /* Filter out security.selinux, it is cached in slab */
                        CDEBUG(D_CACHE, "not caching security.selinux\n");
                        rc = 0;
+               } else if (!strcmp(xdata, XATTR_NAME_SOM)) {
+                       /* Filter out trusted.som, it is not cached on client */
+                       CDEBUG(D_CACHE, "not caching trusted.som\n");
+                       rc = 0;
                } else {
                        rc = ll_xattr_cache_add(&lli->lli_xattrs, xdata, xval,
                                                *xsizes);
                } else {
                        rc = ll_xattr_cache_add(&lli->lli_xattrs, xdata, xval,
                                                *xsizes);
index 40e3d82..19f2212 100755 (executable)
@@ -27697,11 +27697,6 @@ test_807() {
        changelog_users $SINGLEMDS | grep -q $cl_user ||
                error "User $cl_user not found in changelog_users"
 
        changelog_users $SINGLEMDS | grep -q $cl_user ||
                error "User $cl_user not found in changelog_users"
 
-       local save="$TMP/$TESTSUITE-$TESTNAME.parameters"
-       save_lustre_params client "llite.*.xattr_cache" > $save
-       lctl set_param llite.*.xattr_cache=0
-       stack_trap "restore_lustre_params < $save; rm -f $save" EXIT
-
        rm -rf $DIR/$tdir || error "rm $tdir failed"
        mkdir_on_mdt0 $DIR/$tdir || error "mkdir $tdir failed"
        touch $DIR/$tdir/trunc || error "touch $tdir/trunc failed"
        rm -rf $DIR/$tdir || error "rm $tdir failed"
        mkdir_on_mdt0 $DIR/$tdir || error "mkdir $tdir failed"
        touch $DIR/$tdir/trunc || error "touch $tdir/trunc failed"