loop: Add test for changing capacity when filesystem is mounted
PATCH v2 1/1 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".
--- 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
tests/loop/007 new file +39 -0
@@ -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" +}
tests/loop/007.out new file +2 -0
@@ -0,0 +1,2 @@ +Running loop/007 +Test complete
Signature · 1 line
2.16.4
Looks good to me.
From: [email protected] <[email protected]> on behalf of Jan Kara <[email protected]>
Sent: Monday, January 21, 2019 4:02 AM
To: Omar Sandoval
Cc: [email protected]; 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".
---
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
tests/loop/007 new file +39 -0
@@ -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" +}
tests/loop/007.out new file +2 -0
@@ -0,0 +1,2 @@ +Running loop/007 +Test complete
Signature · 1 line
2.16.4
Quoted 5 lines · 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 <[email protected]>
Thanks, Jan, applied.