From patchwork Sun Feb 12 20:43:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9568513 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 666F860476 for ; Sun, 12 Feb 2017 20:44:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57D67281C3 for ; Sun, 12 Feb 2017 20:44:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CBBF28249; Sun, 12 Feb 2017 20:44:03 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 E0AEC281C3 for ; Sun, 12 Feb 2017 20:44:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751307AbdBLUoC (ORCPT ); Sun, 12 Feb 2017 15:44:02 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33143 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751298AbdBLUoB (ORCPT ); Sun, 12 Feb 2017 15:44:01 -0500 Received: by mail-wm0-f66.google.com with SMTP id v77so15873143wmv.0; Sun, 12 Feb 2017 12:44:01 -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=MYE5puepQQAg4OtjbpsD11mWCvWCgPhykzB2BL6ID7Y=; b=lI9LLmSFEx7pjVLVo/afgaHhmDC8Xqy67A2ZrRclnowSi9mMP9fwlsSKfYAotrDaXO PTDn489Z8p6iN6YDIaIBNTsaIJLQ6ukqIQkmjOpRHwyMwX8/TrN7rpU8IeGwLKu5r3sU Dd0Izxn71ITv56uxQI8RwHBGalzQCftlsUxh3t8ftaDgD1dH8PVtJPN2O6g+qeINs2vO ebM1vrA/9NBMnuF3S6iAI8RmmyEDoKjwMnkjfwqq3GO8kRnLVwDWazMmJz/+9I1ms4eu Zma6Okqonmget7KnkWyi3odl07hR6zimwiLrsw3dmBwJDe1Z/UBGRDimFkZchMYRbe6O U+wg== 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=MYE5puepQQAg4OtjbpsD11mWCvWCgPhykzB2BL6ID7Y=; b=Df0gwq+jjl3UT3uqdYbZ1pPCyS1TfXZdCnJ/Qw+6iPnNX8uPqc7xXStVP5//dqnI3g W0bV5JX00WOy7XAjMGcnJ+E5G+Eu9T6mQuoYAKwQ/41rzt37NHJMS198d5DYTDcJXWfL s+RQdTybu8YsD+EkyGmOXIztEhBBX0E7/I0Wp+SW+mM0QAnkE14Mb3xH0U5Hmw2jxUQM lBJ1Q0nroCOW9KVe1MZUg9Js0Sz2yBPaUqCsPXErluDJJn6/TWDuIfED8kPzz5yqVh9f F7qWF/JN1IuvSpEWH4hsnP7k8GmhpcuEt4ye2YtBL9gWe322jw/IPBUsbP6ctTenkp9Z wcEg== X-Gm-Message-State: AMke39mZAi1LPoMNbWZhVWVUxtHRw6A0aoWmCMtPc6RG3VrUqeqCFsEyl9CArIR8FiS2+g== X-Received: by 10.28.210.65 with SMTP id j62mr15720091wmg.9.1486932240286; Sun, 12 Feb 2017 12:44:00 -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 o59sm8040404wrc.56.2017.02.12.12.43.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 12 Feb 2017 12:43:59 -0800 (PST) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v3 5/9] overlay: allow SCRATCH_DEV to be the base fs mount point Date: Sun, 12 Feb 2017 22:43:40 +0200 Message-Id: <1486932224-17075-6-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486932224-17075-1-git-send-email-amir73il@gmail.com> References: <1486932224-17075-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 2827ff4..4e0cbdf 100644 --- a/common/rc +++ b/common/rc @@ -1340,12 +1340,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 # 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:"