generic/530: revert commit f8f57747222
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 20 May 2019 22:30:57 +0000 (15:30 -0700)
committerEryu Guan <guaneryu@gmail.com>
Fri, 24 May 2019 09:16:00 +0000 (17:16 +0800)
Commit f8f57747222 ("generic/530: fix shutdown failure of generic/530 in
overlay") improperly clears an overlayfs test failure by shutting down
the filesystem after all the tempfiles are closed, which totally defeats
the purpose of both generic/530 and xfs/501.  Revert this commit so we
can fix it properly.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.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 0393c6bd837d35778434add6d60fa5331962b335..da9390fd872940a3e364828e37108bcf438ceebb 100644 (file)
@@ -24,6 +24,7 @@ static int min_fd = -1;
 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)
 {
@@ -68,6 +69,22 @@ void die(void)
                                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);
@@ -143,6 +160,8 @@ int main(int argc, char *argv[])
                if (ret)
                        perror(argv[1]);
        }
+       if (argc > 2 && !strcmp(argv[2], "shutdown"))
+               shutdown_fs = 1;
 
        clock_time(&start_time);
        while (1)
index 56c6d32a3f04f53c6edf938059ee45fc59e96814..b0d188b1e2c5167df738bf211fd54d62b1fe88cc 100755 (executable)
@@ -49,9 +49,7 @@ ulimit -n $max_files
 
 # Open a lot of unlinked files
 echo create >> $seqres.full
-$here/src/t_open_tmpfiles $SCRATCH_MNT >> $seqres.full
-_scratch_shutdown -f
-
+$here/src/t_open_tmpfiles $SCRATCH_MNT shutdown >> $seqres.full
 
 # Unmount to prove that we can clean it all
 echo umount >> $seqres.full
index 4be9997c3e8254586fcb470ee53d4291c3d64240..974f341401dd4bd6d8f2ed855398f155babf84a4 100755 (executable)
@@ -54,9 +54,7 @@ ulimit -n $max_files
 
 # Open a lot of unlinked files
 echo create >> $seqres.full
-$here/src/t_open_tmpfiles $SCRATCH_MNT >> $seqres.full
-_scratch_shutdown -f
-
+$here/src/t_open_tmpfiles $SCRATCH_MNT shutdown >> $seqres.full
 
 # Unmount to prove that we can clean it all
 echo umount >> $seqres.full