linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] loop: Add test for changing capacity when filesystem is mounted
@ 2019-01-21 12:02 Jan Kara
  2019-01-22 18:27 ` Chaitanya Kulkarni
  2019-01-23  0:00 ` Omar Sandoval
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Kara @ 2019-01-21 12:02 UTC (permalink / raw)
  To: Omar Sandoval; +Cc: linux-block, Jan Kara

Add test for changing capacity of a loop device when a filesystem with
non-default block size is mounted on it. This is a regression test for
"blockdev: Fix livelocks on loop device".

Signed-off-by: Jan Kara <jack@suse.cz>
---
 tests/loop/007     | 39 +++++++++++++++++++++++++++++++++++++++
 tests/loop/007.out |  2 ++
 2 files changed, 41 insertions(+)
 create mode 100755 tests/loop/007
 create mode 100644 tests/loop/007.out

diff --git a/tests/loop/007 b/tests/loop/007
new file mode 100755
index 000000000000..97e6468de4e5
--- /dev/null
+++ b/tests/loop/007
@@ -0,0 +1,39 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2019 Jan Kara
+#
+# Test loop device capacity change handling with filesystem mounted on top.
+#
+# Regression test for commit 04906b2f542c "blockdev: Fix livelocks on loop
+# device".
+#
+
+. tests/loop/rc
+
+DESCRIPTION="update loop device capacity with filesystem"
+
+QUICK=1
+
+requires() {
+	_have_program mkfs.ext4
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	local mount_dir="/mnt/blktests/"
+
+	truncate -s 1G "$TMPDIR/img"
+	mkdir -p "$mount_dir"
+	local loop_device="$(losetup -P -f --show "$TMPDIR/img")"
+	mkfs.ext4 -b 1024 "$loop_device" &>/dev/null
+	mount -t ext4 "$loop_device" "$mount_dir"
+	losetup -c "$loop_device"
+	# This hangs if rereading capacity changed block size
+	ls -l "$mount_dir" >/dev/null
+	umount "$mount_dir"
+	losetup -d "$loop_device"
+	rm -fr "$mount_dir" "$TMPDIR/img"
+
+	echo "Test complete"
+}
diff --git a/tests/loop/007.out b/tests/loop/007.out
new file mode 100644
index 000000000000..32752934d48a
--- /dev/null
+++ b/tests/loop/007.out
@@ -0,0 +1,2 @@
+Running loop/007
+Test complete
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] loop: Add test for changing capacity when filesystem is mounted
  2019-01-21 12:02 [PATCH v2] loop: Add test for changing capacity when filesystem is mounted Jan Kara
@ 2019-01-22 18:27 ` Chaitanya Kulkarni
  2019-01-23  0:00 ` Omar Sandoval
  1 sibling, 0 replies; 3+ messages in thread
From: Chaitanya Kulkarni @ 2019-01-22 18:27 UTC (permalink / raw)
  To: Jan Kara, Omar Sandoval; +Cc: linux-block

Looks good to me.

Reviewed-by:- Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>.




From: linux-block-owner@vger.kernel.org <linux-block-owner@vger.kernel.org> on behalf of Jan Kara <jack@suse.cz>
Sent: Monday, January 21, 2019 4:02 AM
To: Omar Sandoval
Cc: linux-block@vger.kernel.org; Jan Kara
Subject: [PATCH v2] loop: Add test for changing capacity when filesystem is mounted
  
 
Add test for changing capacity of a loop device when a filesystem with
non-default block size is mounted on it. This is a regression test for
"blockdev: Fix livelocks on loop device".

Signed-off-by: Jan Kara <jack@suse.cz>
---
 tests/loop/007     | 39 +++++++++++++++++++++++++++++++++++++++
 tests/loop/007.out |  2 ++
 2 files changed, 41 insertions(+)
 create mode 100755 tests/loop/007
 create mode 100644 tests/loop/007.out

diff --git a/tests/loop/007 b/tests/loop/007
new file mode 100755
index 000000000000..97e6468de4e5
--- /dev/null
+++ b/tests/loop/007
@@ -0,0 +1,39 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2019 Jan Kara
+#
+# Test loop device capacity change handling with filesystem mounted on top.
+#
+# Regression test for commit 04906b2f542c "blockdev: Fix livelocks on loop
+# device".
+#
+
+. tests/loop/rc
+
+DESCRIPTION="update loop device capacity with filesystem"
+
+QUICK=1
+
+requires() {
+       _have_program mkfs.ext4
+}
+
+test() {
+       echo "Running ${TEST_NAME}"
+
+       local mount_dir="/mnt/blktests/"
+
+       truncate -s 1G "$TMPDIR/img"
+       mkdir -p "$mount_dir"
+       local loop_device="$(losetup -P -f --show "$TMPDIR/img")"
+       mkfs.ext4 -b 1024 "$loop_device" &>/dev/null
+       mount -t ext4 "$loop_device" "$mount_dir"
+       losetup -c "$loop_device"
+       # This hangs if rereading capacity changed block size
+       ls -l "$mount_dir" >/dev/null
+       umount "$mount_dir"
+       losetup -d "$loop_device"
+       rm -fr "$mount_dir" "$TMPDIR/img"
+
+       echo "Test complete"
+}
diff --git a/tests/loop/007.out b/tests/loop/007.out
new file mode 100644
index 000000000000..32752934d48a
--- /dev/null
+++ b/tests/loop/007.out
@@ -0,0 +1,2 @@
+Running loop/007
+Test complete
-- 
2.16.4

    

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] loop: Add test for changing capacity when filesystem is mounted
  2019-01-21 12:02 [PATCH v2] loop: Add test for changing capacity when filesystem is mounted Jan Kara
  2019-01-22 18:27 ` Chaitanya Kulkarni
@ 2019-01-23  0:00 ` Omar Sandoval
  1 sibling, 0 replies; 3+ messages in thread
From: Omar Sandoval @ 2019-01-23  0:00 UTC (permalink / raw)
  To: Jan Kara; +Cc: Omar Sandoval, linux-block

On Mon, Jan 21, 2019 at 01:02:03PM +0100, Jan Kara wrote:
> Add test for changing capacity of a loop device when a filesystem with
> non-default block size is mounted on it. This is a regression test for
> "blockdev: Fix livelocks on loop device".
> 
> Signed-off-by: Jan Kara <jack@suse.cz>

Thanks, Jan, applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-23  0:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-21 12:02 [PATCH v2] loop: Add test for changing capacity when filesystem is mounted Jan Kara
2019-01-22 18:27 ` Chaitanya Kulkarni
2019-01-23  0:00 ` Omar Sandoval

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).