All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org, zlang@redhat.com, fdmanana@kernel.org
Subject: [PATCH v2 2/2] generic: test mount fails on physical device with configured dm volume
Date: Sat, 16 Mar 2024 22:32:34 +0530	[thread overview]
Message-ID: <1b07e16433faa5c149d2f6c0693fbcc656561aad.1710599671.git.anand.jain@oracle.com> (raw)
In-Reply-To: <cover.1710599671.git.anand.jain@oracle.com>

When a dm Flakey device is configured, (or similar dm where both physical
and dm devices are accessible) we have access to both the physical device
and the dm flakey device, ensure that the physical device mount fails.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
Remove redirect for rm
Add _require_test
Add _filter_error_mount
Change log - make it more sound generic with a dm device
Add quick group

 tests/generic/741     | 60 +++++++++++++++++++++++++++++++++++++++++++
 tests/generic/741.out |  3 +++
 2 files changed, 63 insertions(+)
 create mode 100755 tests/generic/741
 create mode 100644 tests/generic/741.out

diff --git a/tests/generic/741 b/tests/generic/741
new file mode 100755
index 000000000000..f8f9a7be7619
--- /dev/null
+++ b/tests/generic/741
@@ -0,0 +1,60 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2024 Oracle.  All Rights Reserved.
+#
+# FS QA Test 741
+#
+# Attempt to mount both the DM physical device and the DM flakey device.
+# Verify the returned error message.
+#
+. ./common/preamble
+_begin_fstest auto quick volume tempfsid
+
+# Override the default cleanup function.
+_cleanup()
+{
+	umount $extra_mnt &> /dev/null
+	rm -rf $extra_mnt
+	_unmount_flakey
+	_cleanup_flakey
+	cd /
+	rm -r -f $tmp.*
+}
+
+# Import common functions.
+. ./common/filter
+. ./common/dmflakey
+
+# real QA test starts here
+_supported_fs generic
+_require_test
+_require_scratch
+_require_dm_target flakey
+
+[ "$FSTYP" = "btrfs" ] && _fixed_by_kernel_commit XXXXXXXXXXXX \
+			"btrfs: return accurate error code on open failure"
+
+_scratch_mkfs >> $seqres.full
+_init_flakey
+_mount_flakey
+
+extra_mnt=$TEST_DIR/extra_mnt
+rm -rf $extra_mnt
+mkdir -p $extra_mnt
+
+# Mount must fail because the physical device has a dm created on it.
+# Filters alter the return code of the mount.
+_mount $SCRATCH_DEV $extra_mnt 2>&1 | \
+			_filter_testdir_and_scratch | _filter_error_mount
+
+# Try again with flakey unmounted, must fail.
+_unmount_flakey
+_mount $SCRATCH_DEV $extra_mnt 2>&1 | \
+			_filter_testdir_and_scratch | _filter_error_mount
+
+# Removing dm should make mount successful.
+_cleanup_flakey
+_scratch_mount
+
+status=0
+exit
diff --git a/tests/generic/741.out b/tests/generic/741.out
new file mode 100644
index 000000000000..b694f5fad6b8
--- /dev/null
+++ b/tests/generic/741.out
@@ -0,0 +1,3 @@
+QA output created by 741
+mount: TEST_DIR/extra_mnt: SCRATCH_DEV already mounted or mount point busy
+mount: TEST_DIR/extra_mnt: SCRATCH_DEV already mounted or mount point busy
-- 
2.39.3


  parent reply	other threads:[~2024-03-16 17:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-16 17:02 [PATCH v2 0/2] fstests: new test cases for generic group Anand Jain
2024-03-16 17:02 ` [PATCH v2 1/2] shared: move btrfs clone device testcase to the shared group Anand Jain
2024-03-18 22:02   ` David Sterba
2024-03-18 22:15     ` Christoph Hellwig
2024-03-19  4:16     ` Zorro Lang
2024-03-19 17:17       ` Anand Jain
2024-03-19 17:27       ` David Sterba
2024-03-19 20:43       ` Christoph Hellwig
2024-03-20 16:08         ` David Sterba
2024-03-21 21:41           ` Christoph Hellwig
2024-04-09 14:43   ` Anand Jain
2024-03-16 17:02 ` Anand Jain [this message]
2024-03-24  8:49   ` [PATCH v2 2/2] generic: test mount fails on physical device with configured dm volume Anand Jain

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=1b07e16433faa5c149d2f6c0693fbcc656561aad.1710599671.git.anand.jain@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=fdmanana@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=zlang@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.