From patchwork Wed Aug 8 03:57:06 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: 10559487 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 C7EE013BB for ; Wed, 8 Aug 2018 03:57:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5F622A580 for ; Wed, 8 Aug 2018 03:57:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9BFA2A592; Wed, 8 Aug 2018 03:57:13 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,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 548562A580 for ; Wed, 8 Aug 2018 03:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726503AbeHHGOs (ORCPT ); Wed, 8 Aug 2018 02:14:48 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:42104 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726373AbeHHGOs (ORCPT ); Wed, 8 Aug 2018 02:14:48 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w783sE8T087737; Wed, 8 Aug 2018 03:57:08 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=dfi0FIoMm9qkB35Jw6Qr5dgxITreWeDKVtLUmbPbmCg=; b=QVHGjdnX4dGZUzVZvugBAv+h5UDQs+1ZtenwOTDqpKTqYwGxKZKV0oL9TQ/bDMcr081Y eXzmkCd4JWuXXGeQ18x5ln7HjHreyFPjCshUK1dNI0jJPa0Kq+WlKl4peqm7yUREOhZu lc+LWGh6dIHwdYWox0MTGqdu8crtfBq+BocIoSIBP+cfDkzMPKjPmt/mHVQSvxgG14kU jujDaSkrgrSO2NiE/UTIIu0je6/wokPmwE+Ll4PjHZSpR4SBC3rSfBpUOamzT4kPBafv TUBOFERtTWpbWZzLoKzdphQkMwIb2Zo8E4j3iQjy3AFJoRjZl5KgThk9piEiraSbbPeX Vg== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2kn1nd45ha-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 08 Aug 2018 03:57:08 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w783v7m0016719 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Aug 2018 03:57:07 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w783v7aE032188; Wed, 8 Aug 2018 03:57:07 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 07 Aug 2018 20:57:07 -0700 Subject: [PATCH 1/4] xfs: xrep_findroot_block should reject root blocks with siblings From: "Darrick J. Wong" To: darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, bfoster@redhat.com, david@fromorbit.com, allison.henderson@oracle.com Date: Tue, 07 Aug 2018 20:57:06 -0700 Message-ID: <153370062610.25077.16005158396857920623.stgit@magnolia> In-Reply-To: <153370061966.25077.161884080659267764.stgit@magnolia> References: <153370061966.25077.161884080659267764.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8978 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808080041 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 xrep_findroot_block, if we find a candidate root block with sibling pointers or sibling blocks on the same tree level, we should not return that block as a tree root because root blocks cannot have siblings. Signed-off-by: Darrick J. Wong --- fs/xfs/scrub/repair.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) -- 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/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c index 85b048b341a0..6c199e2ebb81 100644 --- a/fs/xfs/scrub/repair.c +++ b/fs/xfs/scrub/repair.c @@ -727,6 +727,23 @@ xrep_findroot_block( bp->b_ops->verify_read(bp); if (bp->b_error) goto out; + + /* Root blocks can't have siblings. */ + if (btblock->bb_u.s.bb_leftsib != cpu_to_be32(NULLAGBLOCK) || + btblock->bb_u.s.bb_rightsib != cpu_to_be32(NULLAGBLOCK)) + goto out; + + /* + * If we find a second block at this level, ignore this level because + * it can't possibly be a root level. Maybe we'll find a higher level, + * or maybe the rmap information is garbage. + */ + if (fab->root != NULLAGBLOCK && + fab->height == xfs_btree_get_level(btblock) + 1) { + fab->root = NULLAGBLOCK; + goto out; + } + fab->root = agbno; fab->height = xfs_btree_get_level(btblock) + 1; *found_it = true;