From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10EDDC10F25 for ; Wed, 11 Mar 2020 05:52:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DD5092146E for ; Wed, 11 Mar 2020 05:52:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726310AbgCKFwu (ORCPT ); Wed, 11 Mar 2020 01:52:50 -0400 Received: from mail104.syd.optusnet.com.au ([211.29.132.246]:48623 "EHLO mail104.syd.optusnet.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726198AbgCKFwu (ORCPT ); Wed, 11 Mar 2020 01:52:50 -0400 Received: from dread.disaster.area (pa49-195-202-68.pa.nsw.optusnet.com.au [49.195.202.68]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id BA76A7EA1B2; Wed, 11 Mar 2020 16:52:45 +1100 (AEDT) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1jBuIO-0007GY-07; Wed, 11 Mar 2020 16:52:44 +1100 Date: Wed, 11 Mar 2020 16:52:43 +1100 From: Dave Chinner To: "Darrick J. Wong" Cc: linux-xfs@vger.kernel.org Subject: Re: [PATCH 1/3] xfs: mark dir corrupt when lookup-by-hash fails Message-ID: <20200311055243.GB10776@dread.disaster.area> References: <158388768123.939608.12366470947594416375.stgit@magnolia> <158388768745.939608.14435846701438875494.stgit@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <158388768745.939608.14435846701438875494.stgit@magnolia> User-Agent: Mutt/1.10.1 (2018-07-13) X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=W5xGqiek c=1 sm=1 tr=0 a=mqTaRPt+QsUAtUurwE173Q==:117 a=mqTaRPt+QsUAtUurwE173Q==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=SS2py6AdgQ4A:10 a=yPCof4ZbAAAA:8 a=20KFwNOVAAAA:8 a=7-415B0cAAAA:8 a=MygKMG1BviL1-w2hvasA:9 a=CjuIK1q_8ugA:10 a=biEYGPWJfzWAr4FL6Ov7:22 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org On Tue, Mar 10, 2020 at 05:48:07PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong > > In xchk_dir_actor, we attempt to validate the directory hash structures > by performing a directory entry lookup by (hashed) name. If the lookup > returns ENOENT, that means that the hash information is corrupt. The > _process_error functions don't catch this, so we have to add that > explicitly. > > Signed-off-by: Darrick J. Wong > --- > fs/xfs/scrub/dir.c | 3 +++ > 1 file changed, 3 insertions(+) > > > diff --git a/fs/xfs/scrub/dir.c b/fs/xfs/scrub/dir.c > index 266da4e4bde6..ef7cc8e101ab 100644 > --- a/fs/xfs/scrub/dir.c > +++ b/fs/xfs/scrub/dir.c > @@ -155,6 +155,9 @@ xchk_dir_actor( > xname.type = XFS_DIR3_FT_UNKNOWN; > > error = xfs_dir_lookup(sdc->sc->tp, ip, &xname, &lookup_ino, NULL); > + /* ENOENT means the hash lookup failed and the dir is corrupt */ > + if (error == -ENOENT) > + error = -EFSCORRUPTED; > if (!xchk_fblock_process_error(sdc->sc, XFS_DATA_FORK, offset, > &error)) > goto out; looks good. Reviewed-by: Dave Chinner -- Dave Chinner david@fromorbit.com