[5.4,20/38] nilfs2: replace WARN_ONs by nilfs_error for checkpoint acquisition failure
Message ID | 20221013175144.950270355@linuxfoundation.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp405073wrs; Thu, 13 Oct 2022 10:56:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7uiCwPj5ouhKzd0hkdSjOrAbgosPHHr4M6+i+rVKInoCdX+FhbOXRuL3alsb6JEkZoK9KY X-Received: by 2002:a63:db49:0:b0:439:246e:8091 with SMTP id x9-20020a63db49000000b00439246e8091mr914681pgi.295.1665683807352; Thu, 13 Oct 2022 10:56:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665683807; cv=none; d=google.com; s=arc-20160816; b=iTH327vROS/OV+P5z+9ohhUZQPnze4FXTUdYzGyP7WDqdyYbuODiaS9gEXw+wTdK1R P6Sob4HkYbqgqQnWjGNc2OvzrXc/U/EnjD6SYNb7xsqX9aUyW8/Zwm3heOEcbhO9+xRD XZLBB+2pRf0CnYgELtwa7HcOjvoDJWh6bR5TlIK6q0pozUVUBOqjM/w0jtpoh8LJbYtI xCMPyMGm0KN2GMfA2ye5+A9G/hC/AEdm8/9Devbd50YeA8gnyNqChJVYlLwF/3WP0+tl qv4+F/4gIpn6TmxgE+Sa3S2Q2bk0n4oucKIbXH1iAdTs+o0Rb3vxWJhsbTduNkSQQfVy 9KKQ== 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=kSkOSNfZFT7Qfmz2zilc5ELgLBIkqCQTebf1ovSKwEA=; b=cuI5QxHOvPXdmMG4hsjtCwcYQUO6GzKwMqNck1wK9dxHBxpWcZenYpd8pxCQgibpYj nGiy9qUckM4vpAnSYgQ9SdzZ6MNLVoeRGZvw6mdCKkrION9Bf7PwTpQxN2AW538YKf81 ZcViGn6P4/2nKs6VuxAeSZxeZ+2H7BKzWdJNzGdr1DnfaqtLtODERL1SL9yce5/knY10 u/9GIjc4NMfw1NDszk3drn9wgvZQbaDtd3dN/chswi4U8pTwQPe5jeIwTecv+FYvGHNp HtfI6iIsXoisCfHqSdwCb5ug9lN8UzY5mouBqEANoE/1bAOgiQXtn/vgVVfq5YBHjM5i up7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bkxIvt6s; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lw17-20020a17090b181100b0020db4eeaed5si1017233pjb.137.2022.10.13.10.56.35; Thu, 13 Oct 2022 10:56:47 -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=bkxIvt6s; 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 S230094AbiJMR4S (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Thu, 13 Oct 2022 13:56:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229891AbiJMRzS (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 13 Oct 2022 13:55:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B534F15B30E; Thu, 13 Oct 2022 10:54:19 -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 88CE4618DE; Thu, 13 Oct 2022 17:54:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 908D7C433D6; Thu, 13 Oct 2022 17:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665683652; bh=5/+T7+Hbc+gs+Q2MxLjLyv7qCijM55C8bgamH/I/2XQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bkxIvt6syKoVpL/ILhwyLZLofbasUrbwc2JM1zdSaVeYrkmWpDJvoPJZol5RMTPTU Xyd/BZ1nlsB3U8SORsaBjrfbUBASeLung3tRPVGCSqI16dx2JWc4YaBbMJi47dn8J8 jOfylAd8/wq1OXTTKs7znb/clREHbAfVJf3XWN9g= From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, Ryusuke Konishi <konishi.ryusuke@gmail.com>, syzbot+fbb3e0b24e8dae5a16ee@syzkaller.appspotmail.com, Andrew Morton <akpm@linux-foundation.org> Subject: [PATCH 5.4 20/38] nilfs2: replace WARN_ONs by nilfs_error for checkpoint acquisition failure Date: Thu, 13 Oct 2022 19:52:21 +0200 Message-Id: <20221013175144.950270355@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221013175144.245431424@linuxfoundation.org> References: <20221013175144.245431424@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.1 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746596063931752987?= X-GMAIL-MSGID: =?utf-8?q?1746596063931752987?= |
Series |
None
|
|
Commit Message
Greg KH
Oct. 13, 2022, 5:52 p.m. UTC
From: Ryusuke Konishi <konishi.ryusuke@gmail.com> commit 723ac751208f6d6540191689cfbf6c77135a7a1b upstream. If creation or finalization of a checkpoint fails due to anomalies in the checkpoint metadata on disk, a kernel warning is generated. This patch replaces the WARN_ONs by nilfs_error, so that a kernel, booted with panic_on_warn, does not panic. A nilfs_error is appropriate here to handle the abnormal filesystem condition. This also replaces the detected error codes with an I/O error so that neither of the internal error codes is returned to callers. Link: https://lkml.kernel.org/r/20220929123330.19658-1-konishi.ryusuke@gmail.com Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com> Reported-by: syzbot+fbb3e0b24e8dae5a16ee@syzkaller.appspotmail.com Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- fs/nilfs2/segment.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
--- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -880,9 +880,11 @@ static int nilfs_segctor_create_checkpoi nilfs_mdt_mark_dirty(nilfs->ns_cpfile); nilfs_cpfile_put_checkpoint( nilfs->ns_cpfile, nilfs->ns_cno, bh_cp); - } else - WARN_ON(err == -EINVAL || err == -ENOENT); - + } else if (err == -EINVAL || err == -ENOENT) { + nilfs_error(sci->sc_super, + "checkpoint creation failed due to metadata corruption."); + err = -EIO; + } return err; } @@ -896,7 +898,11 @@ static int nilfs_segctor_fill_in_checkpo err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, 0, &raw_cp, &bh_cp); if (unlikely(err)) { - WARN_ON(err == -EINVAL || err == -ENOENT); + if (err == -EINVAL || err == -ENOENT) { + nilfs_error(sci->sc_super, + "checkpoint finalization failed due to metadata corruption."); + err = -EIO; + } goto failed_ibh; } raw_cp->cp_snapshot_list.ssl_next = 0;