From 06140d1890bb8a5b9047145b1d5806660b39ad63 Mon Sep 17 00:00:00 2001 From: bluhm Date: Tue, 23 Jan 2018 22:30:34 +0000 Subject: [PATCH] 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. --- regress/sys/kern/mount/Makefile | 59 +++++++++++++++++++++++++-------- 1 file 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 &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: -- 2.20.1