Whamcloud - gitweb
LU-1205 tests: sanityn test_18 sometimes takes long time to run
authorJinshan Xiong <jinshan.xiong@whamcloud.com>
Fri, 13 Apr 2012 23:15:51 +0000 (16:15 -0700)
committerOleg Drokin <green@whamcloud.com>
Tue, 15 May 2012 06:51:39 +0000 (02:51 -0400)
This is a live-lock problem where two processes are writing to the
same mmaped file via two nodes. To write a mmap region, both processes
will do:

  acquire cl_lock -> read page -> release cl_lock-> install page.

During the above steps, the page can be truncated after the lock is
released and then immediately cancelled by the other process, so
kernel has to do page fault again and never complete.

Lustre can't handle this case well so this test case is disabled.

Signed-off-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
Change-Id: I0c3fd5beab388cbed6193ae496d4d0e4f23be797
Reviewed-on: http://review.whamcloud.com/2544
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/mmap_sanity.c
lustre/tests/sanityn.sh

index 6b77254..dffdea5 100644 (file)
@@ -55,9 +55,11 @@ char mmap_sanity[256];
 
 static void usage(void)
 {
 
 static void usage(void)
 {
-        printf("Usage: mmap_sanity -d dir [-m dir2]\n");
-        printf("       dir      lustre mount point\n");
-        printf("       dir2     another mount point\n");
+        printf("Usage: mmap_sanity -d dir [-m dir2] [-e <test cases>]\n");
+        printf("       -d dir        lustre mount point\n");
+        printf("       -m dir2       another mount point\n");
+        printf("       -e testcases  skipped test cases, -e 1 -e 2 to exclude"
+                                    " test cases 1 and 2.\n");
         exit(127);
 }
 
         exit(127);
 }
 
@@ -778,6 +780,7 @@ struct test_case {
         char    *desc;                  /* test description */
         int     (*test_fn)(char *mnt);  /* test function */
         int     node_cnt;               /* node count */
         char    *desc;                  /* test description */
         int     (*test_fn)(char *mnt);  /* test function */
         int     node_cnt;               /* node count */
+        int     skipped;                /* skipped by caller */
 };
 
 struct test_case tests[] = {
 };
 
 struct test_case tests[] = {
@@ -791,16 +794,17 @@ struct test_case tests[] = {
         { 6, "mmap test6: check mmap write/read content on two nodes",
                 mmap_tst6, 2 },
         { 7, "mmap test7: file i/o with an unmapped buffer", mmap_tst7, 1},
         { 6, "mmap test6: check mmap write/read content on two nodes",
                 mmap_tst6, 2 },
         { 7, "mmap test7: file i/o with an unmapped buffer", mmap_tst7, 1},
-        { 8, "mmap test8: SIGBUS for beyond file size", mmap_tst8, 1},
+        { 8, "mmap test8: SIGBUS for beyond file size", mmap_tst8, 1 },
         { 0, NULL, 0, 0 }
 };
 
 int main(int argc, char **argv)
 {
         struct test_case *test;
         { 0, NULL, 0, 0 }
 };
 
 int main(int argc, char **argv)
 {
         struct test_case *test;
+        int nr_cases = sizeof(tests)/sizeof(*test);
         int c, rc = 0;
 
         int c, rc = 0;
 
-        while ((c = getopt(argc, argv, "d:m:")) != -1) {
+        while ((c = getopt(argc, argv, "d:m:e:")) != -1) {
                 switch (c) {
                 case 'd':
                         dir = optarg;
                 switch (c) {
                 case 'd':
                         dir = optarg;
@@ -808,6 +812,15 @@ int main(int argc, char **argv)
                 case 'm':
                         dir2 = optarg;
                         break;
                 case 'm':
                         dir2 = optarg;
                         break;
+                case 'e': {
+                        char *endptr = NULL;
+                        rc = strtol(optarg, &endptr, 10);
+                        if (endptr != NULL && *endptr != '\0')
+                                usage();
+                        if (rc > 0 && rc < nr_cases)
+                                tests[rc - 1].skipped = 1;
+                        break;
+                }
                 default:
                         usage();
                         break;
                 default:
                         usage();
                         break;
@@ -822,11 +835,12 @@ int main(int argc, char **argv)
                 return -EINVAL;
         }
 
                 return -EINVAL;
         }
 
+        rc = 0;
         for (test = tests; test->tc; test++) {
         for (test = tests; test->tc; test++) {
-                double duration;
-                char *rs;
+                double duration = 0.0;
+                char *rs = "SKIPPED";
 
 
-                if (test->node_cnt == 1 || dir2 != NULL) {
+                if (!test->skipped && (test->node_cnt == 1 || dir2 != NULL)) {
                         struct timeval start, end;
 
                         gettimeofday(&start, NULL);
                         struct timeval start, end;
 
                         gettimeofday(&start, NULL);
@@ -836,10 +850,8 @@ int main(int argc, char **argv)
                         duration = (double)(end.tv_sec - start.tv_sec) +
                                 (double)(end.tv_usec - start.tv_usec) / 1000000;
                         rs = rc ? "FAIL" : "PASS";
                         duration = (double)(end.tv_sec - start.tv_sec) +
                                 (double)(end.tv_usec - start.tv_usec) / 1000000;
                         rs = rc ? "FAIL" : "PASS";
-                } else {
-                        duration = 0.0;
-                        rs = "SKIP";
                 }
                 }
+
                 fprintf(stderr, "%s (%s, %.5gs)\n", test->desc, rs, duration);
                 if (rc)
                         break;
                 fprintf(stderr, "%s (%s, %.5gs)\n", test->desc, rs, duration);
                 if (rc)
                         break;
index f40be62..dbeba23 100644 (file)
@@ -3,8 +3,8 @@
 set -e
 
 ONLY=${ONLY:-"$*"}
 set -e
 
 ONLY=${ONLY:-"$*"}
-# bug number for skipped test: 3192 15528/3811 16929 9977 15528/11549 18080
-ALWAYS_EXCEPT="                14b  19         22    28   29          35    $SANITYN_EXCEPT"
+# bug number for skipped test: 3192 LU-1205 15528/3811 16929 9977 15528/11549 18080
+ALWAYS_EXCEPT="                14b  18c     19         22    28   29          35    $SANITYN_EXCEPT"
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 # bug number for skipped test:        12652 12652
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 # bug number for skipped test:        12652 12652
@@ -350,7 +350,17 @@ test_17() { # bug 3513, 3667
 run_test 17 "resource creation/LVB creation race ==============="
 
 test_18() {
 run_test 17 "resource creation/LVB creation race ==============="
 
 test_18() {
-       $LUSTRE/tests/mmap_sanity -d $MOUNT1 -m $MOUNT2
+        # turn e.g. ALWAYS_EXCEPT="18c" into "-e 3"
+        local idx
+        local excepts=
+        for idx in {a..z}; do
+                local ptr=EXCEPT_ALWAYS_18$idx
+                [ x${!ptr} = xtrue ] || continue
+
+                excepts="$excepts -e $(($(printf %d \'$idx)-96))"
+        done
+
+       $LUSTRE/tests/mmap_sanity -d $MOUNT1 -m $MOUNT2 $excepts
        sync; sleep 1; sync
 }
 run_test 18 "mmap sanity check ================================="
        sync; sleep 1; sync
 }
 run_test 18 "mmap sanity check ================================="