diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2018-01-23 22:30:35 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2018-01-23 22:30:35 +0000 |
commit | 4065cf6b9182d7cceabf64c0ae25c2470ba8c3db (patch) | |
tree | 1094b61d566c242f7733243cc744691df9046c4b | |
parent | 6d841bf458178b38ff724df82abc9cf49196048b (diff) |
Add a smarter test that opens a file, unlinks it, and remounts the
file system read-only. After unmounting this should result in a
dirty file system that is not marked clean. Disable both tests
with dangling vnodes for now as they fail.
-rw-r--r-- | regress/sys/kern/mount/Makefile | 59 |
1 files changed, 46 insertions, 13 deletions
diff --git a/regress/sys/kern/mount/Makefile b/regress/sys/kern/mount/Makefile index bb5cf66f39c..6825422e6d5 100644 --- a/regress/sys/kern/mount/Makefile +++ b/regress/sys/kern/mount/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.5 2018/01/15 23:58:43 bluhm Exp $ +# $OpenBSD: Makefile,v 1.6 2018/01/23 22:30:34 bluhm Exp $ # This regress test uses a vnd device to run mount and unmount. # All tests have to be run as root. @@ -12,17 +12,18 @@ disk: unconfig vnconfig vnd0 diskimage disklabel -wA -T ${.CURDIR}/disktemplate vnd0 disklabel vnd0 -.for p in a b d e f g h i j k l m n o p - newfs vnd0${p} -.endfor disklabel vnd0 | grep -q '16 partitions:' [ `disklabel vnd0 | grep -c '\<4.2BSD\>'` -eq 15 ] mount: disk + newfs vnd0a mkdir -p /mnt/regress-mount mount /dev/vnd0a /mnt/regress-mount mount-nested: mount +.for p in b d e f g h i j k l m n o p + newfs vnd0${p} +.endfor mkdir /mnt/regress-mount/b mount /dev/vnd0b /mnt/regress-mount/b f=/mnt/regress-mount; for p in d e f g h i j k l m n o p;\ @@ -67,17 +68,26 @@ run-regress-unmount-busy: mount rm -rf /mnt/regress-mount/usr & sleep .1 umount -f /mnt/regress-mount - fsck -f -y /dev/rvnd0a 2>&1 | tee fsck.log - ! egrep 'yes|FILE SYSTEM WAS MODIFIED|MARKING FILE SYSTEM CLEAN' \ - fsck.log + fsck -y /dev/rvnd0a 2>&1 | tee fsck-clean.log + fsck -f -y /dev/rvnd0a 2>&1 | tee fsck-force.log + egrep -q 'File system is clean' \ + fsck-clean.log + ! egrep -q 'yes|FILE SYSTEM WAS MODIFIED|MARKING FILE SYSTEM CLEAN' \ + fsck-force.log + +run-regress-readonly-busy run-regress-readonly-dangling: + # Remounting a file system read-only that has dangling vnodes fails + # currently. It is marked as clean but has unreferneced files. + @echo DISABLED # Create a 1 GB vnd partition and fill the ffs file system it with # cp -r. After 15 seconds clean it with rm -rf. While this is # running, remount read-only with -ur. Unmount the partition and -# run fsck -f to see that everything is clean. +# run fsck -f to see that a file system marked as clean is really +# clean. -REGRESS_TARGETS+= run-regress-mount-readonly -run-regress-mount-readonly: mount +REGRESS_TARGETS+= run-regress-readonly-busy +run-regress-readonly-busy: mount @echo '\n======== $@ ========' cp -r /usr /mnt/regress-mount & sleep 5 @@ -92,9 +102,32 @@ run-regress-mount-readonly: mount pgrep -xf 'rm -rf /mnt/regress-mount/usr' || \ break; sleep 1; done umount /mnt/regress-mount - fsck -f -y /dev/rvnd0a 2>&1 | tee fsck.log - ! egrep 'yes|FILE SYSTEM WAS MODIFIED|MARKING FILE SYSTEM CLEAN' \ - fsck.log + fsck -y /dev/rvnd0a 2>&1 | tee fsck-clean.log + fsck -f -y /dev/rvnd0a 2>&1 | tee fsck-force.log + ! egrep -q 'File system is clean' fsck-clean.log || \ + ! egrep -q 'yes|FILE SYSTEM WAS MODIFIED|MARKING FILE SYSTEM CLEAN' \ + fsck-force.log + +# Open a file, unlink it, and remount the file system read-only. +# Then the file system cannot be clean after unmounting it. +# Check that clean flag is not set and repair it with fsck -y. + +REGRESS_TARGETS+= run-regress-readonly-dangling +run-regress-readonly-dangling: mount + @echo '\n======== $@ ========' + touch /mnt/regress-mount/file + sleep 73 </mnt/regress-mount/file & + sleep .1 + rm /mnt/regress-mount/file + mount -ur /mnt/regress-mount + pkill -xf 'sleep 73' + sleep .1 + umount /mnt/regress-mount + fsck -y /dev/rvnd0a 2>&1 | tee fsck-clean.log + fsck -f -y /dev/rvnd0a 2>&1 | tee fsck-force.log + ! egrep -q 'File system is clean' fsck-clean.log + egrep -q 'yes|FILE SYSTEM WAS MODIFIED|MARKING FILE SYSTEM CLEAN' \ + fsck-clean.log fsck-force.log REGRESS_TARGETS+= run-regress-cleanup run-regress-cleanup: |