From patchwork Mon Jan 14 08:48:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 10761755 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DE42917FB for ; Mon, 14 Jan 2019 08:48:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D100A28BA0 for ; Mon, 14 Jan 2019 08:48:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C51B328B8D; Mon, 14 Jan 2019 08:48:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A19228B9A for ; Mon, 14 Jan 2019 08:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726545AbfANIsR (ORCPT ); Mon, 14 Jan 2019 03:48:17 -0500 Received: from mx2.suse.de ([195.135.220.15]:48710 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726064AbfANIsR (ORCPT ); Mon, 14 Jan 2019 03:48:17 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0AB21AE10; Mon, 14 Jan 2019 08:48:16 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 814251E158F; Mon, 14 Jan 2019 09:48:15 +0100 (CET) From: Jan Kara To: Jens Axboe Cc: , Josef Bacik , Tetsuo Handa , Jan Kara Subject: [PATCH] loop: Add test for changing capacity when filesystem is mounted Date: Mon, 14 Jan 2019 09:48:11 +0100 Message-Id: <20190114084811.14455-4-jack@suse.cz> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190114084811.14455-1-jack@suse.cz> References: <20190114084811.14455-1-jack@suse.cz> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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..1e2bf5131c97 --- /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" + mount -t ext4 "$loop_device" /mnt + losetup -c "$loop_device" + # This hangs if rereading capacity changed block size + l /mnt + umount /mnt + 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