From patchwork Fri Mar 1 23:28:15 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: 10836235 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 43A281575 for ; Fri, 1 Mar 2019 23:28:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2ED572F050 for ; Fri, 1 Mar 2019 23:28:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 233D92F0C2; Fri, 1 Mar 2019 23:28:20 +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 C078D2F050 for ; Fri, 1 Mar 2019 23:28:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726002AbfCAX2T (ORCPT ); Fri, 1 Mar 2019 18:28:19 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:42898 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725966AbfCAX2T (ORCPT ); Fri, 1 Mar 2019 18:28:19 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x21NOI5c122749 for ; Fri, 1 Mar 2019 23:28:18 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=i+A+TH1hAcAzWf6IcwDEb6ubBQtS4SpiUiLBYoRRkRQ=; b=uTuN2OBWE3/GZXfsnrWj+IFL1S8Ay0rnmLI8boc/UF5GVNQ0PLZWPbJmtSRmfwajdM5X M3YI8LptesLSUDdcG0K3XNvgPaHLs6yqAm1xL5Fd4WhLdqIDl/2ru55B4GHDAbVttX8p UqRA0sTQ4UHqtMhiGF42bh1qxvt6CRJdhoaM9hki5nFVw6ANgqgxVf0kOadHYYgMB/QU 0ZqYMuRbeNQjXezDtCF63rviQ0XjbZTNq6TovdWMrP9VL3Wqm0GTmNF8lMfg0zTu+J+r Sa75j33ZbyaQbevNYgl87WJxs5jRxt3hmrtPHD4wpRV/teJnfO7z07IzBUDM/Gv0xedD sQ== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2qtupeten3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 01 Mar 2019 23:28:17 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x21NSGeK001428 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 1 Mar 2019 23:28:17 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x21NSGYV029763 for ; Fri, 1 Mar 2019 23:28:16 GMT Received: from localhost (/10.159.229.175) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 01 Mar 2019 15:28:16 -0800 Subject: [PATCH 13/23] xfs_repair: reinitialize the root directory nlink correctly From: "Darrick J. Wong" To: darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Fri, 01 Mar 2019 15:28:15 -0800 Message-ID: <155148289561.16677.8657255567421403873.stgit@magnolia> In-Reply-To: <155148280859.16677.6057998944865066232.stgit@magnolia> References: <155148280859.16677.6057998944865066232.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9182 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903010161 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 In mk_root_dir, we reinitialize the root directory inode with a link count of 1. This differs from mkfs parseproto, which initializes the root to have a link count of 2. The nlink discrepancy in repair is caught and corrected during phase 7, but this is unnecessary since we should set it properly in the first place. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen --- repair/phase6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repair/phase6.c b/repair/phase6.c index 9477bc25..8a50b350 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -891,7 +891,7 @@ mk_root_dir(xfs_mount_t *mp) ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS; ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS; - set_nlink(VFS_I(ip), 1); /* account for . */ + set_nlink(VFS_I(ip), 2); /* account for . and .. */ times = XFS_ICHGTIME_CHG | XFS_ICHGTIME_MOD; if (ip->i_d.di_version == 3) {