From patchwork Tue Feb 28 12:18:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9595343 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 6C95F60429 for ; Tue, 28 Feb 2017 12:20:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E276284DC for ; Tue, 28 Feb 2017 12:20:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5351E284E9; Tue, 28 Feb 2017 12:20:46 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 0851A284DC for ; Tue, 28 Feb 2017 12:20:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752449AbdB1MUo (ORCPT ); Tue, 28 Feb 2017 07:20:44 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:33744 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751769AbdB1MUQ (ORCPT ); Tue, 28 Feb 2017 07:20:16 -0500 Received: by mail-wr0-f196.google.com with SMTP id g10so1404756wrg.0; Tue, 28 Feb 2017 04:18:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=by1rzlNWn2g0QO1O08sKjBaT+vGRRoBs8TD9iULthy8=; b=Alsuw91buocn25Thjne5n73cRAYA6auZVbDNyzjFS7Ff8dj9wNC2mhAQiktd/eGXV0 fRnORgCWaet9SHUbJqEdHYjjmIgdi6lha3Lr1cenErsO86jnLlOg+GnDvxyuyiO1yjfx YvfE7mb555Reo53ihjipMkPpggj+Q6MPos+slC6Q0eN5G7HrfsQxqDOKsSacL28AgkE7 CiNVU2TKfMnmVGyNqE+LZC9YrPv3JZThr7hwvFa8DJYb6PTFs268RowlTgNzNq3MPGj6 gFm4gfmGznt7uSkHd0eXXSnea80ssYqE/uH3Rbz7hHSS9MoZ8pSkB/A0WqPW4n5EqOgL Paqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=by1rzlNWn2g0QO1O08sKjBaT+vGRRoBs8TD9iULthy8=; b=mYyta/aD/NcWlizT0g3WBRRUx3wR+oDSBNJ/CwhXeCd+MwqxeKO7MmX5OAZ80n0Sd7 3dydyuTzELcZI84WLlJWoVtwH2Qmk7MKKNrgrkYn9H2L57i6gl3mkSkc+izyb/iEODkr xR+2YhIIIstZJiMk3qmjchPFxjp2b/rcczi2LqXyaVzLgEy3lK1LZXxoWzA45sEQPzuu OXzMPMqnNOOyWu6W98D+C6ZaVw0K3MYLoF2sLYQnPvrTvS+s8vr1xuff1weTwnVlvr4i 2o++FKtAtD7yIX9yq2toQHNS9nRlfH3iCu6/P5uG7Q3UwoCoYvEMsv+hhpOE1kYJU8ON fp2w== X-Gm-Message-State: AMke39maaypdfB1u9kwYqHQjncMqBKY7pMPPSZMwCe2YKMwf9aoCFZ68ZVvkLiuLY3gwbw== X-Received: by 10.223.137.2 with SMTP id s2mr2252551wrs.20.1488284330512; Tue, 28 Feb 2017 04:18:50 -0800 (PST) Received: from localhost.localdomain (bzq-79-176-143-83.red.bezeqint.net. [79.176.143.83]) by smtp.gmail.com with ESMTPSA id b58sm2105796wra.47.2017.02.28.04.18.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Feb 2017 04:18:49 -0800 (PST) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , Xiong Zhou , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v5 05/10] fstests: allow overlay SCRATCH_DEV to be a base fs mount point Date: Tue, 28 Feb 2017 14:18:32 +0200 Message-Id: <1488284317-3119-6-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488284317-3119-1-git-send-email-amir73il@gmail.com> References: <1488284317-3119-1-git-send-email-amir73il@gmail.com> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When configure SCRATCH_DEV to a mount point (and not to a directory therein) then user will get a false positive error in scratch tests: $SCRATCH_DEV=/mnt/base/scratch is mounted but not on $SCRATCH_MNT=/mnt/scratch Already mounted result: /dev/sda6 on /mnt/base/scratch type xfs (rw,relatime,attr2,inode64,noquota) This is due to the wrong `grep -F $SCRATCH_DEV` which matches the mount point instead of the device in that mount. Fix _check_mounted_on() to grep the pattern "$dev on " and "$dev on $mnt" instead of just grepping for "$dev" and "$mnt" without the " on " anchor. Signed-off-by: Amir Goldstein --- common/rc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/rc b/common/rc index 4fa211a..fb88ffa 100644 --- a/common/rc +++ b/common/rc @@ -1368,12 +1368,14 @@ _check_mounted_on() local type=$5 # Note that we use -F here so grep doesn't try to interpret an NFS over - # IPv6 server as a regular expression - local mount_rec=`_mount | grep -F "$dev"` + # IPv6 server as a regular expression. Because of that, we cannot use + # ^$dev so we use "$dev on " to avoid matching $dev to mount point field + # for overlay case, where $dev is a directory. + local mount_rec=`_mount | grep -F "$dev on "` [ -n "$mount_rec" ] || return 1 # 1 = not mounted # if it's mounted, make sure its on $mnt - if ! (echo $mount_rec | grep -q "$mnt") + if ! (echo $mount_rec | grep -q "$dev on $mnt") then echo "$devname=$dev is mounted but not on $mntname=$mnt - aborting" echo "Already mounted result:"