[5.19,04/33] nilfs2: replace WARN_ONs by nilfs_error for checkpoint acquisition failure
Message ID | 20221013175145.371745826@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 y7csp425756wrs; Thu, 13 Oct 2022 11:44:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77vkRvNGnQCSOhiZIhyxhndFq52CJUWfWSBKc56ifu2yiYF7y375KsowS+1sLgGSDXDgFK X-Received: by 2002:a63:8b44:0:b0:45f:952f:c426 with SMTP id j65-20020a638b44000000b0045f952fc426mr1038840pge.623.1665686698400; Thu, 13 Oct 2022 11:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665686698; cv=none; d=google.com; s=arc-20160816; b=Ml10/5d9+u6WzkJbzTb7clBwtkNvA4KvD11WpyCEQS0v4PKXTDnMdypctgYt1CENeP 8/JU+tVORWm6IzNnwIM2bmyClkTpCUpr4knn85lUlCjwqAHHJh/7i2MmSB+BN4CzXvAX 7NWsb2wV/+w0BEBiNI6W4+wParmb2Dn4henqST3Hn2+WuvC5dGGZm4NSGlm5bt5asStL 6gnkzcuwzFGlqhpOSBDoPDLnehdk/2OnfJeyshJSjjiSXOxK95FzYdiKiVK48P8QtKpV t1TxOYQ8U2ZVRsrvUyR6qDvOYzyOtnx4A5Rd5OoCv4vKbt31XXZMDMKQO5JJ/IskToSX iTZg== 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=PmQcuGy+XNMWt92OGzWONqWq5HjqaI7BfQ/V1uvUoaKQflv9cyOuXtVMp2Gnptq4OF tZ8Ehsu1xTCx3VRDNJ+z1aHTs6ZxMa2RTa+fFagBILpDBJc1GGQwVsqD+8Zuikgcpn1t gzemKnqDxBBxIPFuSVTqA1CahF+uY8ZnSdecA1D0NBflABadzBJm7ucfON8BLcQjzasq B0nKwX8FhJCGnGSE4Nq+wn+52sqO34dx2hQU/5m/U/DjOSNrH+Y21N7U2+IF7ykQQfXG ZcYPoYz0Tt/mOkFXktn9Pg2fgwSBtr8U6+wuOB1Up2bfpXi+7+PaLV5vRCQjdCtt5wiE nLAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nD3dFIh6; 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 j5-20020a63b605000000b00450b99448b0si153373pgf.341.2022.10.13.11.44.43; Thu, 13 Oct 2022 11:44:58 -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=nD3dFIh6; 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 S230494AbiJMSEq (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Thu, 13 Oct 2022 14:04:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229905AbiJMSDS (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 13 Oct 2022 14:03:18 -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 4AD57160EF2; Thu, 13 Oct 2022 11:03:03 -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 804D761932; Thu, 13 Oct 2022 17:59:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91A75C433C1; Thu, 13 Oct 2022 17:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665683968; bh=T5hUlJubGs9iN1Cr22GehC2ffTzgTKc0wkupXsH0j3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nD3dFIh6WubljEvy960Q3y1ZDFULDS+LDshobU8yA/nY7nU2fyzw0dtXk8ZOeqVDL K1xG9D5YId19t6uSyqpoHSrcvSfC1Z4X63RYH/cMpWoB3EyS5C4qYRuSj4P4pBN1hL Qjq3dMZSRJB3k180U+P0jmxU2wsE8aOOuwtZu6dY= 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.19 04/33] nilfs2: replace WARN_ONs by nilfs_error for checkpoint acquisition failure Date: Thu, 13 Oct 2022 19:52:36 +0200 Message-Id: <20221013175145.371745826@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221013175145.236739253@linuxfoundation.org> References: <20221013175145.236739253@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?1746599095540488441?= X-GMAIL-MSGID: =?utf-8?q?1746599095540488441?= |
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 @@ -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;