From 68330379b01cb6bf9b24235a80a4666d24c0e343 Mon Sep 17 00:00:00 2001 From: Vladimir Saveliev Date: Mon, 23 Dec 2019 14:07:25 +0300 Subject: [PATCH] LU-13099 lmv: disable statahead for remote objects 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 Cray-bug-id: LUS-8262 Change-Id: I8055b6373fb7b9777fa888dcb09384213822a59f Reviewed-on: https://review.whamcloud.com/37089 Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo Reviewed-by: Olaf Faaland-LLNL Reviewed-by: Oleg Drokin --- lustre/lmv/lmv_obd.c | 2 +- lustre/tests/multiop.c | 40 +++++++++++++++++++++++++++++++++++++++- lustre/tests/sanity.sh | 21 +++++++++++++++++++++ lustre/tests/test-framework.sh | 2 +- 4 files changed, 62 insertions(+), 3 deletions(-) mode change 100644 => 100755 lustre/tests/sanity.sh diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 5e7c925..5ab0ebf 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -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)); diff --git a/lustre/tests/multiop.c b/lustre/tests/multiop.c index 56641f1..70b61d8 100644 --- a/lustre/tests/multiop.c +++ b/lustre/tests/multiop.c @@ -52,6 +52,7 @@ #include #include #include +#include #include @@ -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) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh old mode 100644 new mode 100755 index 22af527..218a358 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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 || diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index a1e75c8..25ce901 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -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 -- 1.8.3.1