From patchwork Thu Dec 15 07:19:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 9475619 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 AD66E60571 for ; Thu, 15 Dec 2016 07:19:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9529528662 for ; Thu, 15 Dec 2016 07:19:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87D8428745; Thu, 15 Dec 2016 07:19:56 +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 297B428662 for ; Thu, 15 Dec 2016 07:19:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752428AbcLOHTz (ORCPT ); Thu, 15 Dec 2016 02:19:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52492 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751135AbcLOHTy (ORCPT ); Thu, 15 Dec 2016 02:19:54 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0B00DDB018; Thu, 15 Dec 2016 07:19:54 +0000 (UTC) Received: from localhost (dhcp-13-108.nay.redhat.com [10.66.13.108]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uBF7Jqq7006716; Thu, 15 Dec 2016 02:19:53 -0500 From: Eryu Guan To: fstests@vger.kernel.org Cc: linux-unionfs@vger.kernel.org, Eryu Guan Subject: [PATCH] common/rc: fix detection of already mounted test device Date: Thu, 15 Dec 2016 15:19:31 +0800 Message-Id: <20161215071931.31651-1-eguan@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 15 Dec 2016 07:19:54 +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 I saw this failure in overlayfs testing: +$SCRATCH_DEV=/mnt/ovl/scratch is mounted but not on $SCRATCH_MNT=/mnt/xfstests/mnt2 - aborting +Already mounted result: +/dev/sda5 on /mnt/ovl/scratch type xfs (rw,relatime,seclabel,attr2,inode64,logbsize=256k,sunit=512,swidth=1536,noquota) Because we grep for TEST_DEV and SCRATCH_DEV in mount output to see if test device is already mounted, and report failure if device is not mounted at desired mount point, but in the case of overlayfs testing these "test device"s are directories and may have other real devices mounted there. Fix it by checking TEST_DEV and SCRATCH_DEV at the beginning of mount entries. Signed-off-by: Eryu Guan --- common/rc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/rc b/common/rc index 26d715d..6fcab17 100644 --- a/common/rc +++ b/common/rc @@ -1363,7 +1363,7 @@ _require_scratch_nocheck() # mounted? # Note that we use -F here so grep doesn't try to interpret an NFS over # IPv6 server as a regular expression. - mount_rec=`_mount | grep -F $SCRATCH_DEV` + mount_rec=`_mount | grep -F "^$SCRATCH_DEV"` if [ "$mount_rec" ] then # if it's mounted, make sure its on $SCRATCH_MNT @@ -1448,7 +1448,7 @@ _require_test() # mounted? # Note that we use -F here so grep doesn't try to interpret an NFS over # IPv6 server as a regular expression. - mount_rec=`_mount | grep -F $TEST_DEV` + mount_rec=`_mount | grep -F "^$TEST_DEV"` if [ "$mount_rec" ] then # if it's mounted, make sure its on $TEST_DIR