Whamcloud - gitweb
LU-13099 lmv: disable statahead for remote objects 89/37089/6
authorVladimir Saveliev <c17830@cray.com>
Mon, 23 Dec 2019 11:07:25 +0000 (14:07 +0300)
committerOleg Drokin <green@whamcloud.com>
Tue, 28 Jan 2020 06:02:17 +0000 (06:02 +0000)
Statahead for remote objects is supposed to be disabled by
LU-11681 lmv: disable remote file statahead.

However due to typo it is not and statahead for remote objects is
accompanied by warnings like:
  ll_set_inode()) Can not initialize inode .. without object type..
  ll_prep_inode()) new_inode -fatal: rc -12

Fix the typo.

Test to illustrate the issue is added.

Fixes: 02b5a407081c ("LU-11681 lmv: disable remote file statahead")

Signed-off-by: Vladimir Saveliev <c17830@cray.com>
Cray-bug-id: LUS-8262
Change-Id: I8055b6373fb7b9777fa888dcb09384213822a59f
Reviewed-on: https://review.whamcloud.com/37089
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Olaf Faaland-LLNL <faaland1@llnl.gov>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lmv/lmv_obd.c
lustre/tests/multiop.c
lustre/tests/sanity.sh [changed mode: 0644->0755]
lustre/tests/test-framework.sh

index 5e7c925..5ab0ebf 100644 (file)
@@ -3436,7 +3436,7 @@ int lmv_intent_getattr_async(struct obd_export *exp,
        if (IS_ERR(ptgt))
                RETURN(PTR_ERR(ptgt));
 
-       ctgt = lmv_fid2tgt(lmv, &op_data->op_fid1);
+       ctgt = lmv_fid2tgt(lmv, &op_data->op_fid2);
        if (IS_ERR(ctgt))
                RETURN(PTR_ERR(ctgt));
 
index 56641f1..70b61d8 100644 (file)
@@ -52,6 +52,7 @@
 #include <semaphore.h>
 #include <time.h>
 #include <err.h>
+#include <dirent.h>
 
 #include <lustre/lustreapi.h>
 
@@ -78,9 +79,9 @@ char usage[] =
 "       E[+|-] get lease. +/-: expect lease to (not) exist\n"
 "       f  statfs\n"
 "       F  print FID\n"
-"       H[num] create HSM released file with num stripes\n"
 "       G gid get grouplock\n"
 "       g gid put grouplock\n"
+"       H[num] create HSM released file with num stripes\n"
 "       K  link path to filename\n"
 "       L  link\n"
 "       l  symlink filename to path\n"
@@ -91,6 +92,7 @@ char usage[] =
 "       o  open(O_RDONLY)\n"
 "       O  open(O_CREAT|O_RDWR)\n"
 "       p  print return value of last command\n"
+"       Q  open filename (should be dir), stat first entry to init statahead"
 "       r[num] read [optional length]\n"
 "       R  reference entire mmap-ed region\n"
 "       s  stat\n"
@@ -203,6 +205,35 @@ int get_flags(char *data, int *rflags)
        return size;
 }
 
+static int statahead(char *dname)
+{
+       DIR *d;
+       struct dirent *dent;
+       struct stat st;
+       char *buf;
+       int rc;
+
+       rc = 0;
+       d = opendir(dname);
+       if (!d)
+               return errno;
+       dent = readdir(d);
+       if (!dent) {
+               rc = errno;
+               goto out_closedir;
+       }
+       if (asprintf(&buf, "%s/%s", dname, dent->d_name) == -1) {
+               rc = errno;
+               goto out_closedir;
+       }
+       if (stat(buf, &st))
+               rc = errno;
+       free(buf);
+out_closedir:
+       closedir(d);
+       return rc;
+}
+
 #define POP_ARG() (pop_arg(argc, argv))
 
 int main(int argc, char **argv)
@@ -546,6 +577,13 @@ int main(int argc, char **argv)
                case 'p':
                        printf("%lld\n", last_rc);
                        break;
+               case 'Q':
+                       save_errno = statahead(fname);
+                       if (save_errno) {
+                               perror("statahead");
+                               exit(save_errno);
+                       }
+                       break;
                case 'r':
                        len = atoi(commands + 1);
                        if (len <= 0)
old mode 100644 (file)
new mode 100755 (executable)
index 22af527..218a358
@@ -11162,6 +11162,27 @@ test_123b () { # statahead(bug 15027)
 }
 run_test 123b "not panic with network error in statahead enqueue (bug 15027)"
 
+test_123c() {
+       [[ $MDSCOUNT -lt 2 ]] && skip_env "needs >= 2 MDTs"
+
+       test_mkdir -i 0 -c 1 $DIR/$tdir.0
+       test_mkdir -i 1 -c 1 $DIR/$tdir.1
+       touch $DIR/$tdir.1/{1..3}
+       mv $DIR/$tdir.1/{1..3} $DIR/$tdir.0
+
+       remount_client $MOUNT
+
+       $MULTIOP $DIR/$tdir.0 Q
+
+       # let statahead to complete
+       ls -l $DIR/$tdir.0 > /dev/null
+
+       testid=$(echo $TESTNAME | tr '_' ' ')
+       dmesg | tac | sed "/$testid/,$ d" | grep "Can not initialize inode" &&
+               error "statahead warning" || true
+}
+run_test 123c "Can not initialize inode warning on DNE statahead"
+
 test_124a() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run"
        $LCTL get_param -n mdc.*.connect_flags | grep -q lru_resize ||
index a1e75c8..25ce901 100755 (executable)
@@ -6427,7 +6427,7 @@ run_one() {
        check_node_health
        check_dmesg_for_errors || error "Error in dmesg detected"
        if [ "$PARALLEL" != "yes" ]; then
-               ps auxww | grep -v grep | grep -q multiop &&
+               ps auxww | grep -v grep | grep -q "multiop " &&
                                        error "multiop still running"
        fi
        unset TESTNAME