From patchwork Wed Nov 29 13:48:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10082259 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ABB556020B for ; Wed, 29 Nov 2017 13:48:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BA0B29839 for ; Wed, 29 Nov 2017 13:48:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9068F29846; Wed, 29 Nov 2017 13:48:28 +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=-6.9 required=2.0 tests=BAYES_00,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 0206329839 for ; Wed, 29 Nov 2017 13:48:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754048AbdK2NsZ (ORCPT ); Wed, 29 Nov 2017 08:48:25 -0500 Received: from prv3-mh.provo.novell.com ([137.65.250.26]:50291 "EHLO prv3-mh.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753106AbdK2NsV (ORCPT ); Wed, 29 Nov 2017 08:48:21 -0500 Received: from adam-pc.lan (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Wed, 29 Nov 2017 06:48:11 -0700 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz Subject: [PATCH 2/2] btrfs-progs: tests/convert: Introduce test case to ensure btrfs-convert won't rollback the filesystem after balance Date: Wed, 29 Nov 2017 21:48:06 +0800 Message-Id: <20171129134806.32324-2-wqu@suse.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171129134806.32324-1-wqu@suse.com> References: <20171129134806.32324-1-wqu@suse.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Qu Wenruo --- .../015-not-to-rollback-after-balance/test.sh | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 tests/convert-tests/015-not-to-rollback-after-balance/test.sh diff --git a/tests/convert-tests/015-not-to-rollback-after-balance/test.sh b/tests/convert-tests/015-not-to-rollback-after-balance/test.sh new file mode 100755 index 000000000000..0d523d2250db --- /dev/null +++ b/tests/convert-tests/015-not-to-rollback-after-balance/test.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Check if btrfs-convert refuse to rollback the filesystem, and leave +# the btrfs and the convert image untouched + +source "$TOP/tests/common" +source "$TOP/tests/common.convert" + +setup_root_helper +prepare_test_dev +check_prereq btrfs-convert +check_global_prereq mke2fs + +# convert_test_prep_fs() will create large enough file inside the +# test device, that's good enough for us to test rollback failure. +convert_test_prep_fs ext4 mke2fs -t ext4 -b 4096 +run_check_umount_test_dev +convert_test_do_convert "" 4096 + +run_check_mount_test_dev + +# Now the fs is converted, balance the fs so later rollback should fail +run_check $SUDO_HELPER "$TOP/btrfs" balance start --full-balance $TEST_MNT +run_check_umount_test_dev + +# rollback should fail +run_mustfail "rollback fs after balance" "$TOP/btrfs-convert" -r $TEST_DEV + +# Ensure the fs and convert image can pass the check +run_check "$TOP/btrfs" check $TEST_DEV + +run_check_mount_test_dev +run_check $SUDO_HELPER e2fsck -fn $TEST_MNT/ext2_saved/image +run_check_umount_test_dev