From patchwork Thu Oct 30 13:07:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schumaker, Anna" X-Patchwork-Id: 5197611 Return-Path: X-Original-To: patchwork-fstests@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2C41DC11AC for ; Thu, 30 Oct 2014 13:17:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2C326201EC for ; Thu, 30 Oct 2014 13:17:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4FC2020179 for ; Thu, 30 Oct 2014 13:17:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759431AbaJ3NRK (ORCPT ); Thu, 30 Oct 2014 09:17:10 -0400 Received: from mx1.netapp.com ([216.240.18.38]:31470 "EHLO mx1.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759386AbaJ3NRK (ORCPT ); Thu, 30 Oct 2014 09:17:10 -0400 X-Greylist: delayed 571 seconds by postgrey-1.27 at vger.kernel.org; Thu, 30 Oct 2014 09:17:10 EDT X-IronPort-AV: E=Sophos;i="5.07,285,1413270000"; d="scan'208";a="350599667" Received: from vmwexchts04-prd.hq.netapp.com ([10.122.105.32]) by mx1-out.netapp.com with ESMTP; 30 Oct 2014 06:07:40 -0700 Received: from smtp1.corp.netapp.com (10.57.156.124) by VMWEXCHTS04-PRD.hq.netapp.com (10.122.105.32) with Microsoft SMTP Server id 15.0.995.29; Thu, 30 Oct 2014 06:07:39 -0700 Received: from davros.com ([10.63.227.173]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id s9UD7bW7029411; Thu, 30 Oct 2014 06:07:38 -0700 (PDT) From: Anna Schumaker To: , CC: Subject: [PATCH v2] common: Fixes for testing NFS over IPv6 Date: Thu, 30 Oct 2014 09:07:36 -0400 Message-ID: <1414674456-9097-1-git-send-email-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.1.3 MIME-Version: 1.0 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When testing NFS over IPv6, the user will set a $TEST_DEV of the form [fe80::42]:/export. The use of square brackets surrounding the IPv6 address is an accepted convention, but grep and awk think that our IPv6 address is actually a regex and tries to evaluate it instead. The result is that xfstests reports our filesystem "is busy or already mounted". This patch fixes the IPv6 problem by telling awk and grep to treat $TEST_DEV as a fixed string rather than a regex. Signed-off-by: Anna Schumaker --- common/rc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/common/rc b/common/rc index 747cf72..9f17564 100644 --- a/common/rc +++ b/common/rc @@ -809,14 +809,16 @@ _df_device() exit 1 fi + # Note that we use "==" here so awk doesn't try to interpret an NFS over + # IPv6 server as a regular expression. $DF_PROG 2>/dev/null | $AWK_PROG -v what=$1 ' - match($1,what) && NF==1 { + ($1==what) && (NF==1) { v=$1 getline print v, $0 exit } - match($1,what) { + ($1==what) { print exit } @@ -1132,10 +1134,12 @@ _require_test() esac # mounted? - if _mount | grep -q $TEST_DEV + # Note that we use -F here so grep doesn't try to interpret an NFS over + # IPv6 server as a regular expression. + if _mount | grep -F -q $TEST_DEV then # if it's mounted, make sure its on $TEST_DIR - if ! _mount | grep $TEST_DEV | grep -q $TEST_DIR + if ! _mount | grep -F $TEST_DEV | grep -q $TEST_DIR then echo "\$TEST_DEV is mounted but not on \$TEST_DIR - aborting" exit 1