Hi Jan, Thanks for the test. 1 From 45a003672775cb6dcebc99d7ddfe19a1c9507ac3 Mon Sep 17 00:00:00 2001 2 From: Jan Kara <jack@xxxxxxx> 3 Date: Mon, 14 Jan 2019 09:23:42 +0100 4 Subject: [PATCH v2] loop: Add test for changing capacity when filesystem is 5 mounted 6 7 Add test for changing capacity of a loop device when a filesystem with 8 non-default block size is mounted on it. This is a regression test for 9 "blockdev: Fix livelocks on loop device". 10 11 Signed-off-by: Jan Kara <jack@xxxxxxx> 12 --- 13 tests/loop/007 | 38 ++++++++++++++++++++++++++++++++++++++ 14 tests/loop/007.out | 2 ++ 15 2 files changed, 40 insertions(+) 16 create mode 100755 tests/loop/007 17 create mode 100644 tests/loop/007.out 18 19 diff --git a/tests/loop/007 b/tests/loop/007 20 new file mode 100755 21 index 000000000000..3598aeba4443 22 --- /dev/null 23 +++ b/tests/loop/007 24 @@ -0,0 +1,38 @@ 25 +#!/bin/bash 26 +# SPDX-License-Identifier: GPL-3.0+ 27 +# Copyright (C) 2019 Jan Kara 28 +# 29 +# Test loop device capacity change handling with filesystem mounted on top. 30 +# 31 +# Regression test for patch "blockdev: Fix livelocks on loop device". 32 +# 33 + 34 +. tests/loop/rc 35 + 36 +DESCRIPTION="update loop device capacity with filesystem" 37 + 38 +QUICK=1 39 + 40 +requires() { 41 + _have_program mkfs.ext4 42 +} 43 + 44 +test() { 45 + echo "Running ${TEST_NAME}" 46 + Can we add loop module load/unload at the start and end of the test case ? or is there any specific reason we are not loading and unloading the module in this test ? 47 + local mount_dir="/mnt/blktests/" 48 + 49 + truncate -s 1G "$TMPDIR/img" 50 + mkdir -p "$mount_dir" 51 + local loop_device="$(losetup -P -f --show "$TMPDIR/img")" 52 + mkfs.ext4 -b 1024 "$loop_device" &>/dev/null 53 + mount -t ext4 "$loop_device" "$mount_dir" 54 + losetup -c "$loop_device" 55 + # This hangs if rereading capacity changed block size 56 + ls -l "$mount_dir" >/dev/null 57 + umount "$mount_dir" 58 + losetup -d "$loop_device" 59 + rm -fr "$mount_dir" "$TMPDIR/img" 60 + 61 + echo "Test complete" 62 +} 63 diff --git a/tests/loop/007.out b/tests/loop/007.out 64 new file mode 100644 65 index 000000000000..32752934d48a 66 --- /dev/null 67 +++ b/tests/loop/007.out 68 @@ -0,0 +1,2 @@ 69 +Running loop/007 70 +Test complete 71 -- 72 2.16.4 73 -ck From: linux-block-owner@xxxxxxxxxxxxxxx <linux-block-owner@xxxxxxxxxxxxxxx> on behalf of Jan Kara <jack@xxxxxxx> Sent: Monday, January 14, 2019 2:50 AM To: Jens Axboe Cc: Jan Kara; linux-block@xxxxxxxxxxxxxxx; Josef Bacik; Tetsuo Handa Subject: Re: [PATCH] loop: Add test for changing capacity when filesystem is mounted 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