generic/530: fix shutdown failure of generic/530 in overlay
authorJeffle Xu <jefflexu@linux.alibaba.com>
Mon, 13 May 2019 06:11:05 +0000 (14:11 +0800)
committerEryu Guan <guaneryu@gmail.com>
Tue, 14 May 2019 02:58:59 +0000 (10:58 +0800)
Testcases are recommended to use  _require_scratch_shutdown()
and _scratch_shutdown() pair helper function to test and execute
shutdown.

generic/530 formmerly used _require_scratch_shutdown() to test
whether the filesystem supports shutdown or not, while executed
the shutdown action in a raw binary (src/t_open_tmpfiles) rather
than the recommended _scratch_shutdown() helper. This will cause
a "shutdown: Inappropriate ioctl for device" error message when
testing overlay filesystem.

This patch simply move the shutdown action from the raw binary
into the packaged _scratch_shutdown() helper. That is, we remove
the "shutdown" interface of t_open_tmpfiles.c and call
_scratch_shutdown() in genric/530 and xfs/501.

Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
src/t_open_tmpfiles.c
tests/generic/530
tests/xfs/501

index da9390fd872940a3e364828e37108bcf438ceebb..0393c6bd837d35778434add6d60fa5331962b335 100644 (file)
@@ -24,7 +24,6 @@ static int min_fd = -1;
 static int max_fd = -1;
 static unsigned int nr_opened = 0;
 static float start_time;
 static int max_fd = -1;
 static unsigned int nr_opened = 0;
 static float start_time;
-static int shutdown_fs = 0;
 
 void clock_time(float *time)
 {
 
 void clock_time(float *time)
 {
@@ -69,22 +68,6 @@ void die(void)
                                end_time - start_time);
                fflush(stdout);
 
                                end_time - start_time);
                fflush(stdout);
 
-               if (shutdown_fs) {
-                       /*
-                        * Flush the log so that we have to process the
-                        * unlinked inodes the next time we mount.
-                        */
-                       int flag = XFS_FSOP_GOING_FLAGS_LOGFLUSH;
-                       int ret;
-
-                       ret = ioctl(min_fd, XFS_IOC_GOINGDOWN, &flag);
-                       if (ret) {
-                               perror("shutdown");
-                               exit(2);
-                       }
-                       exit(0);
-               }
-
                clock_time(&start_time);
                for (fd = min_fd; fd <= max_fd; fd++)
                        close(fd);
                clock_time(&start_time);
                for (fd = min_fd; fd <= max_fd; fd++)
                        close(fd);
@@ -160,8 +143,6 @@ int main(int argc, char *argv[])
                if (ret)
                        perror(argv[1]);
        }
                if (ret)
                        perror(argv[1]);
        }
-       if (argc > 2 && !strcmp(argv[2], "shutdown"))
-               shutdown_fs = 1;
 
        clock_time(&start_time);
        while (1)
 
        clock_time(&start_time);
        while (1)
index b0d188b1e2c5167df738bf211fd54d62b1fe88cc..56c6d32a3f04f53c6edf938059ee45fc59e96814 100755 (executable)
@@ -49,7 +49,9 @@ ulimit -n $max_files
 
 # Open a lot of unlinked files
 echo create >> $seqres.full
 
 # Open a lot of unlinked files
 echo create >> $seqres.full
-$here/src/t_open_tmpfiles $SCRATCH_MNT shutdown >> $seqres.full
+$here/src/t_open_tmpfiles $SCRATCH_MNT >> $seqres.full
+_scratch_shutdown -f
+
 
 # Unmount to prove that we can clean it all
 echo umount >> $seqres.full
 
 # Unmount to prove that we can clean it all
 echo umount >> $seqres.full
index 974f341401dd4bd6d8f2ed855398f155babf84a4..4be9997c3e8254586fcb470ee53d4291c3d64240 100755 (executable)
@@ -54,7 +54,9 @@ ulimit -n $max_files
 
 # Open a lot of unlinked files
 echo create >> $seqres.full
 
 # Open a lot of unlinked files
 echo create >> $seqres.full
-$here/src/t_open_tmpfiles $SCRATCH_MNT shutdown >> $seqres.full
+$here/src/t_open_tmpfiles $SCRATCH_MNT >> $seqres.full
+_scratch_shutdown -f
+
 
 # Unmount to prove that we can clean it all
 echo umount >> $seqres.full
 
 # Unmount to prove that we can clean it all
 echo umount >> $seqres.full