common/rc: add scratch shutdown support for overlayfs

Enable shutdown tests on overlayfs. This requires configuring
overlayfs with TEST|SCRATCH_DEV pointing to block device, which act
as base fs of overlay. The legacy config (pointing TEST|SCRATCH_DEV
to existing directories) won't support shutdown.

Extend _require_scratch_shutdown() to deal with overlay by checking
shutdown support on $OVL_BASE_SCRATCH_MNT instead of $SCRATCH_MNT,
so we check shutdown support status against the underlying upper fs
of overlay.

Introduce new _scratch_shutdown() helper to do the actual shutdown
work and shutdown upper fs in the case of overlay. Also converting
existing bare 'src/godown' calls to use this helper to avoid false
failures when testing overlayfs.

generic/042 and generic/050 assume $SCRATCH_DEV to be a local
device, so add _require_local_device $SCRATCH_DEV rule.

[eguan: rewrite commit log]

Signed-off-by: Chengguang Xu <cgxu519@icloud.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Chengguang Xu
2017-12-15 15:47:33 +08:00
committed by Eryu Guan
parent db71085194
commit 2b4eae7fd8
19 changed files with 55 additions and 20 deletions
+2 -1
View File
@@ -54,6 +54,7 @@ _supported_fs generic
_supported_os Linux
_require_scratch
_require_local_device $SCRATCH_DEV
_require_scratch_shutdown
_require_command "$KILLALL_PROG" "killall"
@@ -72,7 +73,7 @@ for i in $(seq 1 $((50 * TIME_FACTOR)) ); do
# purposely include 0 second sleeps to test shutdown immediately after
# recovery
sleep $((RANDOM % 3))
./src/godown $SCRATCH_MNT
_scratch_shutdown
ps -e | grep fsstress > /dev/null 2>&1
while [ $? -eq 0 ]; do