From patchwork Fri Mar 23 16:54:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10305143 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 26BD6605F7 for ; Fri, 23 Mar 2018 16:54:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1695228FDC for ; Fri, 23 Mar 2018 16:54:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B41F29091; Fri, 23 Mar 2018 16:54:42 +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_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY 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 B344628FDF for ; Fri, 23 Mar 2018 16:54:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751930AbeCWQyl (ORCPT ); Fri, 23 Mar 2018 12:54:41 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:44884 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751632AbeCWQyk (ORCPT ); Fri, 23 Mar 2018 12:54:40 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2NGrDWi083601; Fri, 23 Mar 2018 16:54:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=VZIL/CFH9loLIzItzLo6rcx/YzgIvsTEde4/c/Ck78M=; b=cewN8tUU2UvgmU+LFtnbaX3S8aBIwyAShN/7BICxut+l055HTajsgzxuiUIXRgDhLY7I 6s5SJsbIPbA2fHeAU8WBE3m8HqfUmsXDz9maNcgljD8F7oSPGZau+pPlIwj3zo8WokD2 tMyDTo5Lao65ceuS2L4122MzDEAnU1xhNb03zVXJ8pdyK4TgPYG8ac+WfnkFFMlhi5NE ved4yxE5YnAjTYRoyN0HTAGq7Had7xX2sXLRd2Ud8fyHhVpKeOZ+/frDE8JfYMU8RRuB GEArrGZgan6UGaJrXS+mjbsh++mo8MiZc26mm8HrqFATsDIfDCEEVYK5TGQMFIeJ2/J0 3A== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2gw5g580bd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Mar 2018 16:54:37 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w2NGsapX026209 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Mar 2018 16:54:37 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w2NGsaqM010619; Fri, 23 Mar 2018 16:54:36 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 23 Mar 2018 09:54:36 -0700 Subject: [PATCH 2/4] common/xfs: fix various problems with _supports_xfs_scrub From: "Darrick J. Wong" To: eguan@linux.alibaba.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Fri, 23 Mar 2018 09:54:35 -0700 Message-ID: <152182407507.14523.13692488779696151853.stgit@magnolia> In-Reply-To: <152182406249.14523.2186010254497227366.stgit@magnolia> References: <152182406249.14523.2186010254497227366.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8841 signatures=668695 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=792 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803200127 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong The _supports_xfs_scrub helper is called with a mountpoint (a working mountpoint is required for scrub) and a block device (used to detect norecovery mounts). If either of these conditions aren't satisfied we should return failure status to the caller, not unilaterally decide to bail out of the test. Signed-off-by: Darrick J. Wong --- common/xfs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/common/xfs b/common/xfs index 1d98ba1..3b71e02 100644 --- a/common/xfs +++ b/common/xfs @@ -305,9 +305,13 @@ _supports_xfs_scrub() local mountpoint="$1" local device="$2" - if [ ! -b "$device" ] || [ ! -e "$mountpoint" ]; then + if [ -z "$device" ] || [ -z "$mountpoint" ]; then echo "Usage: _supports_xfs_scrub mountpoint device" - exit 1 + return 1 + fi + + if [ ! -b "$device" ] || [ ! -e "$mountpoint" ]; then + return 1 fi test "$FSTYP" = "xfs" || return 1