From patchwork Thu Oct 13 17:52:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 2222 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp411387wrs; Thu, 13 Oct 2022 11:08:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Yixxbwmtkpda3DNtXQjjFHNx2GuccC7PfMdwUGf8BLqSTp2Y3AsOpSwtcVUKo9eepf+6b X-Received: by 2002:a65:5886:0:b0:439:8dd3:18d4 with SMTP id d6-20020a655886000000b004398dd318d4mr976552pgu.430.1665684508190; Thu, 13 Oct 2022 11:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665684508; cv=none; d=google.com; s=arc-20160816; b=BxKmZHMnbgqkEu6NDtZH2en4Y3mkKkNw0KAZ1fB5GPfKNzEnGfdZC9gToTdFdld185 VjgCfYdvqG8e/X59+7b+VVkEffMeX8HR9BxZ1/RmkiRFN/xcPeogdqLlD21N/K7O8A/x qZpIJcUUM8nA76yoaAkr8B3W2ZbG/9zl21RsrKqQ+aJlY9k4mW+pjbsgulyH/JzpgUAy 91onqSD4SsG60NAWeQ/rfOthoyPopukKdnPRtmP8s1wIaRyZplm5qfgHclXfIKp0oEkd cdW6izzOxRXQ0WJ/ezZBE3B5dPyK2A2pO3j0wJPbAMLSIrhu/7ZvCJhW0Yxw9RwxFLs+ d06g== 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=aNgRi6K6QlKRGK4Ipwa6FfNJWusnQAp2ZBui43ru6fM=; b=PMFPNuGQWyxh9P5O6ScLF2uq9TDBXGKx66gjDbri3XWMq1NFab7m70yk0wo2Pb5ciP bDBYO5Q8f6IegwQQkLO7MdKELAkjY6w+I2IxVuotCesYjlDO+CAhplmjMNxl40S6CKuM c5ocbROVxiPCBDJPqkOyEq71lJSzLP/KPD0Q773Z4+MFdgF+Y5vrkMBRwA4wJqDBLlS0 hXqkJGmx17mVIyVZvAUUHCNkz/ULOWotgPugIScbV7NQLUdvAO18CBRyr0k0d/PShlzK NGSuOW8OHtX+uNUWNFx0pl6zQTi8DB9qURgKY24fvwMApyf3wqf8mseFLDYMEwhg/Vmh 2yAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x1foWNh7; 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 c13-20020a170903234d00b0017f685b47b8si453473plh.151.2022.10.13.11.08.15; Thu, 13 Oct 2022 11:08:28 -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=x1foWNh7; 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 S229925AbiJMSGj (ORCPT + 99 others); Thu, 13 Oct 2022 14:06:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231425AbiJMSEV (ORCPT ); Thu, 13 Oct 2022 14:04:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6957615B313; Thu, 13 Oct 2022 11:04:10 -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 F214E61921; Thu, 13 Oct 2022 17:58:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A014C433C1; Thu, 13 Oct 2022 17:58:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665683910; bh=T5hUlJubGs9iN1Cr22GehC2ffTzgTKc0wkupXsH0j3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x1foWNh7k21DgB0UnQgNC36KTILZOU3Dhtc/3U1mv8Aby3ou+XaOnWHin8vVmtYyk lBKHadawNIpLf9p5/e7rUfWfNR/XSHwrvr1KH6QLAi81yHitR5H5ky2SjEjydqI5Iv /7nj4ELJQ5caFuWFV0xkQGqk3OVyiT/kFCqbCAKY= 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 5.15 04/27] nilfs2: replace WARN_ONs by nilfs_error for checkpoint acquisition failure Date: Thu, 13 Oct 2022 19:52:33 +0200 Message-Id: <20221013175143.690903420@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221013175143.518476113@linuxfoundation.org> References: <20221013175143.518476113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746596799269469568?= X-GMAIL-MSGID: =?utf-8?q?1746596799269469568?= 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 @@ -875,9 +875,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; } @@ -891,7 +893,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;