From patchwork Fri Jan 20 20:25:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 9529385 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 CD18360434 for ; Fri, 20 Jan 2017 20:27:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7EB6286B6 for ; Fri, 20 Jan 2017 20:27:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCD43286CD; Fri, 20 Jan 2017 20:27:35 +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.9 required=2.0 tests=BAYES_00, 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 5B2DF286D1 for ; Fri, 20 Jan 2017 20:27:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753248AbdATU1a (ORCPT ); Fri, 20 Jan 2017 15:27:30 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:29391 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753383AbdATU0U (ORCPT ); Fri, 20 Jan 2017 15:26:20 -0500 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v0KKPnEI001239 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Jan 2017 20:25:50 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v0KKPnUN027135 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Jan 2017 20:25:49 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v0KKPnvw028338; Fri, 20 Jan 2017 20:25:49 GMT Received: from localhost (/24.21.211.40) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 20 Jan 2017 12:25:48 -0800 Subject: [PATCH 5/5] xfs_repair: trash dirattr btrees that cycle to the root From: "Darrick J. Wong" To: sandeen@redhat.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Fri, 20 Jan 2017 12:25:47 -0800 Message-ID: <148494394775.5256.15878832693432189642.stgit@birch.djwong.org> In-Reply-To: <148494391629.5256.3328772079712970611.stgit@birch.djwong.org> References: <148494391629.5256.3328772079712970611.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] 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 If xfs_repair detects a dir/attr btree that cycles back to the root, the tree should be cleared and/or rebuilt instead of simply aborting the repair program. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen --- repair/attr_repair.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 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/repair/attr_repair.c b/repair/attr_repair.c index b855a10..37a821b 100644 --- a/repair/attr_repair.c +++ b/repair/attr_repair.c @@ -763,7 +763,12 @@ process_leaf_attr_level(xfs_mount_t *mp, * 0 is the root block and no block * pointer can point to the root block of the btree */ - ASSERT(da_bno != 0); + if (da_bno == 0) { + do_warn( + _("btree cycle detected in attribute fork for inode %" PRIu64 "\n"), + ino); + goto error_out; + } if (dev_bno == NULLFSBLOCK) { do_warn(