From patchwork Tue Nov 14 10:53:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 10057355 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 E8BC06023A for ; Tue, 14 Nov 2017 10:55:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E246C29152 for ; Tue, 14 Nov 2017 10:55:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5B24292F7; Tue, 14 Nov 2017 10:55:06 +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=unavailable 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 75F9829152 for ; Tue, 14 Nov 2017 10:55:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755041AbdKNKzE (ORCPT ); Tue, 14 Nov 2017 05:55:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44762 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755015AbdKNKyu (ORCPT ); Tue, 14 Nov 2017 05:54:50 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 964DEC059B60; Tue, 14 Nov 2017 10:54:50 +0000 (UTC) Received: from localhost (unknown [10.66.12.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F428865F5; Tue, 14 Nov 2017 10:54:49 +0000 (UTC) From: Eryu Guan To: fstests@vger.kernel.org Cc: misono.tomohiro@jp.fujitsu.com, linux-xfs@vger.kernel.org, Eryu Guan Subject: [PATCH 1/3] fstests: filter mount error message for EUCLEAN and ESTALE Date: Tue, 14 Nov 2017 18:53:59 +0800 Message-Id: <20171114105401.10542-2-eguan@redhat.com> In-Reply-To: <20171114105401.10542-1-eguan@redhat.com> References: <20171114105401.10542-1-eguan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 14 Nov 2017 10:54:50 +0000 (UTC) Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP util-linux commit ea848180dd34 ("libmount: add mnt_context_get_excode()") since v2.30 changed the error message on EUCLEAN and ESTALE again (and maybe other errno too): - mount: on failed: Structure needs cleaning + mount: : mount(2) system call failed: Structure needs cleaning. and it causes xfs/005, overlay/037 to fail (and probably xfs/333 too, but it's always _notrun for now). So let's filter out the changing parts and keep the error message simple. Signed-off-by: Eryu Guan --- common/filter | 23 +++++++++++++++++++++++ tests/overlay/037 | 4 ++-- tests/overlay/037.out | 4 ++-- tests/xfs/005 | 7 +------ tests/xfs/333 | 2 +- tests/xfs/333.out | 2 +- 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/common/filter b/common/filter index 0cb458b0051f..d1bb94818e3d 100644 --- a/common/filter +++ b/common/filter @@ -390,6 +390,13 @@ _filter_fstrim() egrep -o "[0-9]+ bytes" | $AWK_PROG '{print $1}' } +# Remove the ending dot appended to mount error message, util-linux 2.30 +# starts to do so. +_filter_ending_dot() +{ + sed -e "s/\.$//" +} + # Older mount output referred to "block device" when mounting RO devices # It's gone in newer versions _filter_ro_mount() { @@ -397,6 +404,22 @@ _filter_ro_mount() { -e "s/mount: cannot mount block device/mount: cannot mount/g" } +# Filter a failed mount output, util-linux changed the message several times. +# +# prior to v2.21: +# mount: Structure needs cleaning +# v2.21 to v2.29: +# mount: mount on failed: Structure needs cleaning +# v2.30 and later: +# mount: : mount(2) system call failed: Structure needs cleaning. +# +# This is also true for ESTALE error. So let's remove all the changing parts +# and keep the 'prior to v2.21' format. +_filter_error_mount() +{ + sed -e "s/mount:\(.*failed:\)/mount:/" | _filter_ending_dot +} + _filter_od() { BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT) diff --git a/tests/overlay/037 b/tests/overlay/037 index 728732903358..b897ec9263ee 100755 --- a/tests/overlay/037 +++ b/tests/overlay/037 @@ -76,12 +76,12 @@ $UMOUNT_PROG $SCRATCH_MNT # Try to mount an overlay with the same upperdir and different lowerdir - expect ESTALE _overlay_scratch_mount_dirs $lowerdir2 $upperdir $workdir -oindex=on \ - 2>&1 | _filter_scratch + 2>&1 | _filter_scratch | _filter_error_mount $UMOUNT_PROG $SCRATCH_MNT 2>/dev/null # Try to mount an overlay with the same workdir and different upperdir - expect ESTALE _overlay_scratch_mount_dirs $lowerdir $upperdir2 $workdir -oindex=on \ - 2>&1 | _filter_scratch + 2>&1 | _filter_scratch | _filter_error_mount $UMOUNT_PROG $SCRATCH_MNT 2>/dev/null # Mount overlay with original lowerdir, upperdir, workdir and index=on - expect success diff --git a/tests/overlay/037.out b/tests/overlay/037.out index 786ef85c29e3..d6ad7cfad687 100644 --- a/tests/overlay/037.out +++ b/tests/overlay/037.out @@ -1,3 +1,3 @@ QA output created by 037 -mount: mount SCRATCH_DEV on SCRATCH_MNT failed: Stale file handle -mount: mount SCRATCH_DEV on SCRATCH_MNT failed: Stale file handle +mount: Stale file handle +mount: Stale file handle diff --git a/tests/xfs/005 b/tests/xfs/005 index fade4bbf282b..ebf4b15ec9b5 100755 --- a/tests/xfs/005 +++ b/tests/xfs/005 @@ -40,11 +40,6 @@ _cleanup() rm -f $tmp.* } -filter_mount() -{ - sed -e "s/mount .* failed: //" -} - # get standard environment, filters and checks . ./common/rc . ./common/filter @@ -64,7 +59,7 @@ _scratch_mkfs_xfs -m crc=1 >> $seqres.full 2>&1 || _fail "mkfs failed" $XFS_IO_PROG -c "pwrite 224 4" -c fsync $SCRATCH_DEV | _filter_xfs_io # should FAIL, the crc is bad; golden output contains mount failure -_scratch_mount 2>&1 | filter_mount +_scratch_mount 2>&1 | _filter_error_mount # success, all done status=0 diff --git a/tests/xfs/333 b/tests/xfs/333 index bf0c811d2435..0a66f08a1062 100755 --- a/tests/xfs/333 +++ b/tests/xfs/333 @@ -64,7 +64,7 @@ _scratch_unmount echo "Corrupt fs" _scratch_xfs_db -x -c 'sb 0' -c "write rrmapino $ino" >> $seqres.full -_scratch_mount 2>&1 | _filter_scratch +_scratch_mount 2>&1 | _filter_scratch | _filter_error_mount echo "Test done, mount should have failed" diff --git a/tests/xfs/333.out b/tests/xfs/333.out index f7518f46d900..b3c698750f8f 100644 --- a/tests/xfs/333.out +++ b/tests/xfs/333.out @@ -2,5 +2,5 @@ QA output created by 333 Format and mount Create some files Corrupt fs -mount: mount SCRATCH_DEV on SCRATCH_MNT failed: Structure needs cleaning +mount: Structure needs cleaning Test done, mount should have failed