From patchwork Mon Oct 24 11:29:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8557 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417299wru; Mon, 24 Oct 2022 05:12:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ZKQawzId+e1BBv7CGM/iygMLMlwSjwxiffOyMJ1GH8vZSJQHjJLfOQZLV2TmCsbWtanlS X-Received: by 2002:a17:907:60c8:b0:78d:bc56:8f04 with SMTP id hv8-20020a17090760c800b0078dbc568f04mr26146722ejc.560.1666613575080; Mon, 24 Oct 2022 05:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613575; cv=none; d=google.com; s=arc-20160816; b=NTIGrXamMknOiY1NOmus6tyIkMet+P0IAWA8W6K03n3qgtnaIfebfA/NcrbBLQehU9 4+frGAuem+/PxZQTCEXHXUs/oMBEvQQnszfBEwbnulBPe1ajKQG5LOhzSpDZDkcdfoa+ n/X4IZicACreWLLJz5iGO0yQ8A6mtbUJAKRqF1O0kI9mzy7A/JSzOyHNto459NjYM0sx X5Vo0WsfIGimMXu0REj/Mbdw4D5wTt4L2BMweHL45FsDFCR1w4cdOIiosJ5Tjqs7zZ7/ lJrqgdRQAlhoBrtNmX9cl4BJhQ8fwwgxhKZDuBl3IHLGIvbmok63CIA6pCYOJ4cLRWlh /+rQ== 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=VqkD/nkhMGhudOfeJeix208hJTZvfukAfhg3TtWawxU=; b=vb8yDJ9SvRQZmb7+gYQ5f08hfpXUMukJ7b8SzzkhxF5HE3ET0v4e0iehOiZ8lFYjbo UgRtMLvi+SFyDxpwyH914XF3NkPBCEiFHVNFhp59+fKhE/2OJbaYcvZEvVJoOREuE663 r1ZD47aYiyk8EBM3YSwlKiaRSCs+gjA9ShHIaWloSSjU4+jcDm8jiTodmlLuQOgsRvZ2 dpn1U16bvmDIH7iz7DRxakNAlrPA9No84QLC7q9WB6VO48DNp9zKOLgJsWYzmtreFfab r+hfGzCcc/er9+07tLsqDR6M2O/OBNExYRMDKK+cCDOGw9PFOyh9wY1NiVksj5tjZffS 6miQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=it0mRzUA; 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 r23-20020a056402019700b00460ff7dc801si10221188edv.445.2022.10.24.05.12.29; Mon, 24 Oct 2022 05:12:55 -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=it0mRzUA; 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 S232529AbiJXMCZ (ORCPT + 99 others); Mon, 24 Oct 2022 08:02:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232670AbiJXL7c (ORCPT ); Mon, 24 Oct 2022 07:59:32 -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 C08787C1B6; Mon, 24 Oct 2022 04:48:36 -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 BBC336122D; Mon, 24 Oct 2022 11:48:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7B2AC433D6; Mon, 24 Oct 2022 11:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612099; bh=UMm37vhx2Pm1xPMwjWbO6ZLH1cF6XvpSLwvokmNXpfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=it0mRzUAeDhB6etket/FKuDDKgt42F7aX4gP7X9WWiHmhfLVklRCxQYY4gL7HAkQt spl5b6/Gk8n5YuGzTEBVmoQKX3NarpehHfrk9rPnPpkCuEyjMk0fLuXLQiyUtnwQq6 xcyLPwBhZDc2FUItJvlcaiJTyIUV5A0Qn6/5m1/4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryusuke Konishi , syzbot+fbb3e0b24e8dae5a16ee@syzkaller.appspotmail.com, Andrew Morton Subject: [PATCH 4.14 038/210] nilfs2: replace WARN_ONs by nilfs_error for checkpoint acquisition failure Date: Mon, 24 Oct 2022 13:29:15 +0200 Message-Id: <20221024112958.222143094@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570995938977871?= X-GMAIL-MSGID: =?utf-8?q?1747570995938977871?= From: Ryusuke Konishi 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 Reported-by: syzbot+fbb3e0b24e8dae5a16ee@syzkaller.appspotmail.com Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/nilfs2/segment.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -890,9 +890,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; } @@ -906,7 +908,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;