Re: [PATCH] loop: Add test for changing capacity when filesystem is mounted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon 14-01-19 11:41:19, Jan Kara wrote:
> On Mon 14-01-19 18:44:22, Tetsuo Handa wrote:
> > Thank you for the patch.
> > 
> > On 2019/01/14 17:48, Jan Kara wrote:
> > > +	# This hangs if rereading capacity changed block size
> > > +	l /mnt
> > 
> > Is 'l' defined as an alias to 'ls' ? I suggest not depending on such alias,
> > for at least 'l' is not defined in my environment.
> 
> Yeah, my bad. I have it everywhere and my finger memory just typed it into
> the test :). Of course 'ls -l' is better for the test so I'll fix it up in
> the next version. Thanks for review.

The test had a couple more bugs which should be fixed now so attached is a
new version which I've actually tested inside the blktests framework ;).

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR
>From 45a003672775cb6dcebc99d7ddfe19a1c9507ac3 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@xxxxxxx>
Date: Mon, 14 Jan 2019 09:23:42 +0100
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@xxxxxxx>
---
 tests/loop/007     | 38 ++++++++++++++++++++++++++++++++++++++
 tests/loop/007.out |  2 ++
 2 files changed, 40 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..3598aeba4443
--- /dev/null
+++ b/tests/loop/007
@@ -0,0 +1,38 @@
+#!/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 patch "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


[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux