From patchwork Thu Mar 14 21:05:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10853617 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF0E917E6 for ; Thu, 14 Mar 2019 21:05:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A97D82A24E for ; Thu, 14 Mar 2019 21:05:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A803F2A7AB; Thu, 14 Mar 2019 21:05:34 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, 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 57B622A24E for ; Thu, 14 Mar 2019 21:05:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727388AbfCNVFe (ORCPT ); Thu, 14 Mar 2019 17:05:34 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:51296 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727366AbfCNVFd (ORCPT ); Thu, 14 Mar 2019 17:05:33 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x2EKwtAU102632; Thu, 14 Mar 2019 21:05:32 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-2018-07-02; bh=K5sMzxySs0XG7290aEJjjIBFxnryZu0HEpPADNhTox8=; b=tWOF0GIeoMXSPSHxBP8v4CJtU/CGChH+ZjduWiJCqZE0krYXFICGFCj35WXC40WAzFU4 o2UZ5EnxBTU9Z6GznST5ok2yg6mGzgwO02mbAVxJjUTnYpq/5kKQujQZ+b8+x2Dflz0A jfaY+GmxJzfSWTKrgctXcKZzA121DHSoL1bYAfImFkHRB/RWsemhRXGeF6AvzsLLZSQM 9HSeMK//uJytbw7PESZzSENs+O67VIYYkFg0w/SwtaMaZ8BvKgoeedR37clFFCSbbuk+ pPA881h8g+PvgJpPPiYMi54jzXurgGwPm++0ByTXnRE5SAzb/joXuXpkML2pEj3ONl+L lw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2r464ruej6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Mar 2019 21:05:31 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x2EL5Uw2019658 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Mar 2019 21:05:30 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x2EL5Tfs020159; Thu, 14 Mar 2019 21:05:30 GMT Received: from localhost (/10.145.178.102) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 14 Mar 2019 21:05:29 +0000 Subject: [PATCH 16/36] xfs_scrub: don't close mnt_fd when mnt_fd open fails From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Thu, 14 Mar 2019 14:05:29 -0700 Message-ID: <155259752927.31886.10173767197190539382.stgit@magnolia> In-Reply-To: <155259742281.31886.17157720770696604377.stgit@magnolia> References: <155259742281.31886.17157720770696604377.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9195 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=976 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903140143 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 If we fail to open the mountpoint during phase 1 of scrub, don't bother trying to close the file descriptor since it's silly to spray error messages about that. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen --- scrub/phase1.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scrub/phase1.c b/scrub/phase1.c index 6b472147..04a5f4a9 100644 --- a/scrub/phase1.c +++ b/scrub/phase1.c @@ -59,9 +59,11 @@ xfs_cleanup_fs( if (ctx->datadev) disk_close(ctx->datadev); fshandle_destroy(); - error = close(ctx->mnt_fd); - if (error) - str_errno(ctx, _("closing mountpoint fd")); + if (ctx->mnt_fd >= 0) { + error = close(ctx->mnt_fd); + if (error) + str_errno(ctx, _("closing mountpoint fd")); + } fs_table_destroy(); return true;