From patchwork Wed Aug 24 02:24:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 9296723 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 976F1607D0 for ; Wed, 24 Aug 2016 02:25:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85F6428DBF for ; Wed, 24 Aug 2016 02:25:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7AD1828DD8; Wed, 24 Aug 2016 02:25:01 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from oss.sgi.com (oss.sgi.com [192.48.182.195]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F1EDE28DBF for ; Wed, 24 Aug 2016 02:24:59 +0000 (UTC) Received: from oss.sgi.com (localhost [IPv6:::1]) by oss.sgi.com (Postfix) with ESMTP id 4CDBD7CA2; Tue, 23 Aug 2016 21:24:59 -0500 (CDT) X-Original-To: xfs@oss.sgi.com Delivered-To: xfs@oss.sgi.com Received: from relay.sgi.com (relay2.corp.sgi.com [137.38.102.29]) by oss.sgi.com (Postfix) with ESMTP id D700F7CA1 for ; Tue, 23 Aug 2016 21:24:57 -0500 (CDT) Received: from cuda.sgi.com (cuda1.sgi.com [192.48.157.11]) by relay2.corp.sgi.com (Postfix) with ESMTP id 81A5730404E for ; Tue, 23 Aug 2016 19:24:57 -0700 (PDT) X-ASG-Debug-ID: 1472005493-0bf8155c7412b960001-NocioJ Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) by cuda.sgi.com with ESMTP id PRGnX390v3uGKf3a (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 23 Aug 2016 19:24:54 -0700 (PDT) X-Barracuda-Envelope-From: darrick.wong@oracle.com X-Barracuda-Effective-Source-IP: aserp1040.oracle.com[141.146.126.69] X-Barracuda-Apparent-Source-IP: 141.146.126.69 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u7O2Oq9X002278 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Aug 2016 02:24:53 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u7O2Oq0x004492 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 24 Aug 2016 02:24:52 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u7O2OpAO001405; Wed, 24 Aug 2016 02:24:51 GMT Received: from localhost (/24.21.211.40) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 23 Aug 2016 19:24:51 -0700 Subject: [PATCH 4/7] libxcmd: fix mount option parsing to find rt/log devices From: "Darrick J. Wong" X-ASG-Orig-Subj: [PATCH 4/7] libxcmd: fix mount option parsing to find rt/log devices To: david@fromorbit.com, darrick.wong@oracle.com Date: Tue, 23 Aug 2016 19:24:50 -0700 Message-ID: <147200548998.15538.11330546457799095768.stgit@birch.djwong.org> In-Reply-To: <147200546481.15538.12724000421579716885.stgit@birch.djwong.org> References: <147200546481.15538.12724000421579716885.stgit@birch.djwong.org> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Source-IP: userv0022.oracle.com [156.151.31.74] X-Barracuda-Connect: aserp1040.oracle.com[141.146.126.69] X-Barracuda-Start-Time: 1472005494 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 X-Barracuda-URL: https://192.48.157.11:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 1504 X-Virus-Scanned: by bsmtpd at sgi.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=2.7 tests=BSF_SC0_MISMATCH_TO, UNPARSEABLE_RELAY X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.32272 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 BSF_SC0_MISMATCH_TO Envelope rcpt doesn't match header 0.00 UNPARSEABLE_RELAY Informational: message has unparseable relay lines Cc: linux-xfs@vger.kernel.org, xfs@oss.sgi.com X-BeenThere: xfs@oss.sgi.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com X-Virus-Scanned: ClamAV using ClamSMTP It turns out that glibc's hasmntopt implementation returns NULL if the opt parameter ends with an equals ('='). Therefore, we cannot directly search for the option 'rtdev='; we must instead have hasmntopt look for 'rtdev' and look for the trailing equals sign ourselves. This fixes xfs_info's reporting of external log and realtime device paths, and xfs_scrub will need it for data block scrubbing of realtime extents. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- libxcmd/paths.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libxcmd/paths.c b/libxcmd/paths.c index 71af25f..b08985f 100644 --- a/libxcmd/paths.c +++ b/libxcmd/paths.c @@ -234,10 +234,17 @@ fs_extract_mount_options( { char *fslog, *fsrt; - /* Extract log device and realtime device from mount options */ - if ((fslog = hasmntopt(mnt, "logdev="))) + /* + * Extract log device and realtime device from mount options. + * + * Note: the glibc hasmntopt implementation requires that the + * character in mnt_opts immediately after the search string + * must be a NULL ('\0'), a comma (','), or an equals ('='). + * Therefore we cannot search for 'logdev=' directly. + */ + if ((fslog = hasmntopt(mnt, "logdev")) && fslog[6] == '=') fslog += 7; - if ((fsrt = hasmntopt(mnt, "rtdev="))) + if ((fsrt = hasmntopt(mnt, "rtdev")) && fsrt[5] == '=') fsrt += 6; /* Do this only after we've finished processing mount options */