generic/062, 520: Don't remove lost+found during cleanup
authorXiao Yang <yangx.jy@cn.fujitsu.com>
Tue, 11 Dec 2018 06:36:17 +0000 (14:36 +0800)
committerEryu Guan <guaneryu@gmail.com>
Fri, 14 Dec 2018 03:17:45 +0000 (11:17 +0800)
On older e2fsprogs, fsck command will check lost+found for extX,
so that it will get error if lost+found has been removed during
cleanup.  For example:
----------------------------------------------------------
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
/lost+found not found.  Create? no
...
----------------------------------------------------------
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/062
tests/generic/520

index b6e28e0fd34808c65f9c8ef9940238d158ad5b10..3fef02e8fc284afbb5597f926bf5f2468b40de0b 100755 (executable)
@@ -176,7 +176,7 @@ echo "*** backup everything"
 _backup $tmp.backup1
 
 echo "*** clear out the scratch device"
 _backup $tmp.backup1
 
 echo "*** clear out the scratch device"
-rm -fr $SCRATCH_MNT/*
+rm -rf $(find $SCRATCH_MNT/* | grep -v "lost+found")
 echo "AFTER REMOVE" >>$seqres.full
 getfattr -L -R -m '.' $SCRATCH_MNT >>$seqres.full
 
 echo "AFTER REMOVE" >>$seqres.full
 getfattr -L -R -m '.' $SCRATCH_MNT >>$seqres.full
 
index 4058262bdff8818f000a65292d454df11a39560a..167d707759dbb5c5935ed8f960740b6c7722786e 100755 (executable)
@@ -57,7 +57,7 @@ after=""
 clean_dir()
 {
        _mount_flakey
 clean_dir()
 {
        _mount_flakey
-       rm -rf $SCRATCH_MNT/*
+       rm -rf $(find $SCRATCH_MNT/* | grep -v "lost+found")
        sync
        _unmount_flakey
 }
        sync
        _unmount_flakey
 }