From patchwork Thu Feb 16 19:57:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9578285 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 AADD760244 for ; Thu, 16 Feb 2017 19:57:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D6FE27C05 for ; Thu, 16 Feb 2017 19:57:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9260C2866B; Thu, 16 Feb 2017 19:57:29 +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 3610227C05 for ; Thu, 16 Feb 2017 19:57:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933136AbdBPT52 (ORCPT ); Thu, 16 Feb 2017 14:57:28 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:35989 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933158AbdBPT52 (ORCPT ); Thu, 16 Feb 2017 14:57:28 -0500 Received: by mail-wr0-f195.google.com with SMTP id z61so2495597wrc.3; Thu, 16 Feb 2017 11:57:27 -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=hq9fkO22Z0SgQYRu/U36Tm6hT4tf3stmsW0rjHGkjB8=; b=dHFSka+2f/yHkj2Exd/7MNFwOrljq6vZaTj4mdzQUirVPeU+71/CtJTWJ+tywgnSLi 1KDtPTYGpWk0tSMED+HqbJu3dfFykNuOBdQfgnYm7s/GHYpK8bEp9pREUu4t+8OFlLk7 5iiV2QyVjDKUSUwCsWQgXb4Jran9EalVvQ+XN4TDiiczjCTYLMDDbsun9rdnqI0Z3d9E Lv7LdzJjHh0Ue5D95sBzFDTcP+OhNheaAZDpmqXZZhbfWI3mfRiObzJ32eRUS9/CyeHq cO0OXBY92jKipQqPu1wyDbIEbBxTQW2O+zr8A6juZfmcOBfLMg9T7msYm1f0drFprsyf XfPg== 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=hq9fkO22Z0SgQYRu/U36Tm6hT4tf3stmsW0rjHGkjB8=; b=tDmTxJ9FUhH7fSnNtZC16U5y2Ub9r9nKF9upCW30HfS5ibVP0JGk0HiIcEisz8eTZh CTQ4BUBrRZqv/DCSMdQd27g3D1qa+Dgwq1ugOGmIn8BuQ7w1lKw9oNjmHfyOIobHAVFP oadBVgC02QuLPRlp1dLAgeKyYQ42oBfvXWbhCylGR1CVVZmOY2t52j3jGdUUvL+kduFz DIkwsOv1LvIluTuKcnJBMqtz+767R8gjArMNx59GpYLC4yyKdmjML4p/0Aze9nMPLu+u Fi5EZOamWAeuS5N4HrrPf8+vzdZPARRa9BRYv8KTBuSyTwbLPCsKO+LxAvhYrJeJk7A8 ve8w== X-Gm-Message-State: AMke39m3rs/YJyZeESgnumNnB2aJO7uXuXEMknheSeOee0PhafgKYsykiBVlXOmFgOakCA== X-Received: by 10.223.172.136 with SMTP id o8mr1834708wrc.87.1487275046594; Thu, 16 Feb 2017 11:57:26 -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 c9sm1437210wmf.18.2017.02.16.11.57.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Feb 2017 11:57:25 -0800 (PST) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v4 05/10] overlay: allow SCRATCH_DEV to be the base fs mount point Date: Thu, 16 Feb 2017 21:57:03 +0200 Message-Id: <1487275028-29885-6-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487275028-29885-1-git-send-email-amir73il@gmail.com> References: <1487275028-29885-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 45e7202..866735d 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 # 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:"