Linux block layer
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: linux-block@vger.kernel.org, Ming Lei <ming.lei@redhat.com>
Subject: [PATCH V2] blktests: add test to cover umount one deleted disk
Date: Wed,  8 Feb 2023 09:02:35 +0800	[thread overview]
Message-ID: <20230208010235.553252-1-ming.lei@redhat.com> (raw)

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>
---
V2:
	- add 032.out

 tests/block/032     | 35 +++++++++++++++++++++++++++++++++++
 tests/block/032.out |  2 ++
 2 files changed, 37 insertions(+)
 create mode 100755 tests/block/032
 create mode 100644 tests/block/032.out

diff --git a/tests/block/032 b/tests/block/032
new file mode 100755
index 0000000..b07b7ab
--- /dev/null
+++ b/tests/block/032
@@ -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
index 0000000..3604e9e
--- /dev/null
+++ b/tests/block/032.out
@@ -0,0 +1,2 @@
+Running block/032
+Test complete
-- 
2.38.1


             reply	other threads:[~2023-02-08  1:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08  1:02 Ming Lei [this message]
2023-02-08  7:39 ` [PATCH V2] blktests: add test to cover umount one deleted disk Shinichiro Kawasaki
2023-02-08  7:42   ` Ming Lei
2023-02-08 11:43     ` Shinichiro Kawasaki
2023-02-14  4:27       ` Shinichiro Kawasaki
2023-02-14  6:37         ` Chaitanya Kulkarni
2023-02-08 10:34 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230208010235.553252-1-ming.lei@redhat.com \
    --to=ming.lei@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox