]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
block/032: add test to cover umount one deleted disk
authorMing Lei <ming.lei@redhat.com>
Wed, 8 Feb 2023 01:02:35 +0000 (09:02 +0800)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Wed, 8 Feb 2023 07:57:07 +0000 (16:57 +0900)
disk can be disappear any time because of error handling, when
it is usually being mounted. Make sure umount can be done successfully
after disk deleting is done from error handling.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/linux-block/20230208063552.GA15030@lst.de/T/#u
[Shin'ichiro: fixed commit title and added Link tag]
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
tests/block/032 [new file with mode: 0755]
tests/block/032.out [new file with mode: 0644]

diff --git a/tests/block/032 b/tests/block/032
new file mode 100755 (executable)
index 0000000..b07b7ab
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2023 Ming Lei
+#
+# Test umount after deleting disk. Removes a device while the disk
+# is still mounted.
+
+. tests/block/rc
+. common/xfs
+. common/scsi_debug
+
+DESCRIPTION="remove one mounted device"
+QUICK=1
+
+requires() {
+       _have_xfs && _have_scsi_debug
+}
+
+test() {
+       echo "Running ${TEST_NAME}"
+
+       if ! _init_scsi_debug dev_size_mb=300; then
+               return 1
+       fi
+
+       mkdir -p "${TMPDIR}/mnt"
+       _xfs_mkfs_and_mount "/dev/${SCSI_DEBUG_DEVICES[0]}" "${TMPDIR}/mnt" > /dev/null 2>&1
+       echo 1 > "/sys/block/${SCSI_DEBUG_DEVICES[0]}/device/delete"
+       sleep 2
+       umount "${TMPDIR}/mnt"
+
+       _exit_scsi_debug
+
+       echo "Test complete"
+}
diff --git a/tests/block/032.out b/tests/block/032.out
new file mode 100644 (file)
index 0000000..3604e9e
--- /dev/null
@@ -0,0 +1,2 @@
+Running block/032
+Test complete