Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp808253rwb; Mon, 26 Sep 2022 06:12:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7L7OQ/Qwf5dwFl2O5IVS7wLYM/UhI/IH4gCTt3p60qiIb7lAGQ9Uzzl1ldsQXyf9Eds9Ii X-Received: by 2002:a17:907:845:b0:731:2f6c:6dbd with SMTP id ww5-20020a170907084500b007312f6c6dbdmr18374949ejb.551.1664197922191; Mon, 26 Sep 2022 06:12:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664197922; cv=none; d=google.com; s=arc-20160816; b=oC+pmJnvxO1uO0kz4vEwmJnhevjV0ATUuwTisbP7chqLhKR/XXuXXNol+SJxW31Ik4 RV06a5qlVyPIFISg1jYPBHCVKH+8mxjirH7fSEhV/uDgzIbzOhE9KTRZ7ezStUQCcYtl aDVSQcNqR2XYt/Q1GBP1EWgA2hs0Sm+ObQ3+37X+7Vnnzf0JfINHdTkwtjYA895HM9UM KXoUvWUohm0DVjv5DkjjAVyaKIYdml6rjiQ6TQj1TteRFbU6/o2AnGY0XvL3dAI+zMkl tOO3o1fB/yyqyTLUc1mj4nMemCFumcIkxv+8XNpuq5gKqbXqbnUnxDW98UeK2BiJJVIQ tKQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uEmyOYPqJSItaf2t2/Xiwoxumi848sjqlAUV7iRoChM=; b=tiOlGXzqws/Ggfw2BadX7xKdUnBCOJEJKY7zf7DWpRPbNlpvJDfB/ZQxdXA38r9r6V RpJvr/V80sBkeYQ/ORJXO7f9SAv8m2IkEMpSwd3ZCdr2/WS3bWuoADWzdtNTU4y7z6Y9 N0N49INiItXkHKCUG05wgEJhrQrYVE69mOKHPH1/Zy2fVN13f/ljORYSGlDeNKpcWPDd h9f7Q3O64Ccf7/4mkmnnQUFOnTaAXxbQzmA9ISJBNc/Ic5ujF6yALyFS5S3reubW4Y0c DcKm/XvqRe3MtJayC9njOtcjgZLV1DKcbIdNuFYbyPFkl0xU4Igy6llaoijtRyXkIURR bxyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bTNOENAU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 23-20020a508e17000000b004517955b673si14691285edw.124.2022.09.26.06.11.19; Mon, 26 Sep 2022 06:12:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bTNOENAU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234568AbiIZKrc (ORCPT + 99 others); Mon, 26 Sep 2022 06:47:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236838AbiIZKos (ORCPT ); Mon, 26 Sep 2022 06:44:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EECC1564ED; Mon, 26 Sep 2022 03:25:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E13D160AD6; Mon, 26 Sep 2022 10:25:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7A14C433D6; Mon, 26 Sep 2022 10:25:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187946; bh=Yx5KjNu28FOaAb4M8e0v2V3JY3kgb65cFo5nXDHD86E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bTNOENAUse78j9B6zgiGGtyaY1A4Z/fQQSdouLwAHvw144HUy8TB0+KrzjlRApfDE GSNPQYIDpqYlJE0Ib4V7vUestmD1qfc7AUDYDRmmuoj2nmxzAECcsRiMSmvgIF0zQP E70iaaoV2YgdZzsjjQKvLIgvsFGrg6JkNEmNCanE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Christoph Hellwig , Brian Foster , "Darrick J. Wong" , Chandan Babu R Subject: [PATCH 5.4 104/120] xfs: replace -EIO with -EFSCORRUPTED for corrupt metadata Date: Mon, 26 Sep 2022 12:12:17 +0200 Message-Id: <20220926100754.785888139@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100750.519221159@linuxfoundation.org> References: <20220926100750.519221159@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Darrick J. Wong" commit c2414ad6e66ab96b867309454498f7fb29b7e855 upstream. There are a few places where we return -EIO instead of -EFSCORRUPTED when we find corrupt metadata. Fix those places. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Brian Foster Acked-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Greg Kroah-Hartman --- fs/xfs/libxfs/xfs_bmap.c | 6 +++--- fs/xfs/xfs_attr_inactive.c | 6 +++--- fs/xfs/xfs_dquot.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -1374,7 +1374,7 @@ xfs_bmap_last_before( case XFS_DINODE_FMT_EXTENTS: break; default: - return -EIO; + return -EFSCORRUPTED; } if (!(ifp->if_flags & XFS_IFEXTENTS)) { @@ -1475,7 +1475,7 @@ xfs_bmap_last_offset( if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE && XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS) - return -EIO; + return -EFSCORRUPTED; error = xfs_bmap_last_extent(NULL, ip, whichfork, &rec, &is_empty); if (error || is_empty) @@ -5872,7 +5872,7 @@ xfs_bmap_insert_extents( del_cursor); if (stop_fsb >= got.br_startoff + got.br_blockcount) { - error = -EIO; + error = -EFSCORRUPTED; goto del_cursor; } --- a/fs/xfs/xfs_attr_inactive.c +++ b/fs/xfs/xfs_attr_inactive.c @@ -209,7 +209,7 @@ xfs_attr3_node_inactive( */ if (level > XFS_DA_NODE_MAXDEPTH) { xfs_trans_brelse(*trans, bp); /* no locks for later trans */ - return -EIO; + return -EFSCORRUPTED; } node = bp->b_addr; @@ -258,7 +258,7 @@ xfs_attr3_node_inactive( error = xfs_attr3_leaf_inactive(trans, dp, child_bp); break; default: - error = -EIO; + error = -EFSCORRUPTED; xfs_trans_brelse(*trans, child_bp); break; } @@ -341,7 +341,7 @@ xfs_attr3_root_inactive( error = xfs_attr3_leaf_inactive(trans, dp, bp); break; default: - error = -EIO; + error = -EFSCORRUPTED; xfs_trans_brelse(*trans, bp); break; } --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c @@ -1125,7 +1125,7 @@ xfs_qm_dqflush( xfs_buf_relse(bp); xfs_dqfunlock(dqp); xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); - return -EIO; + return -EFSCORRUPTED; } /* This is the only portion of data that needs to persist */