Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2187855rwl; Thu, 13 Apr 2023 02:59:23 -0700 (PDT) X-Google-Smtp-Source: AKy350axoZaMRZVONER9MW73fiJwPCdAGnnkbAWLCekMENfLAWXgCv+Ik5Kt3S1BUhA+mxLFjNZS X-Received: by 2002:a05:6a21:328a:b0:ec:5ba5:8a73 with SMTP id yt10-20020a056a21328a00b000ec5ba58a73mr1658633pzb.26.1681379963234; Thu, 13 Apr 2023 02:59:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681379963; cv=none; d=google.com; s=arc-20160816; b=aIk/cltAp7Wj5w84yh5cxM9XLlsv2/6lUloeL+hEWA6Ilmc/ejAfAFdeJ8GgJ+21zB fPBHFWyF4HCaXxjOMFoMgX7kmdu2nUfY7QJ60WUws0NU3/YV2H6AQq8xi/n/wF6AG67/ bXDIeAQI8s4OwbcC2rXjiKhPvtruFmUIVQErKL4ZwI3tIHm4wD+nZWdZ2IksjmmFw0ke PkUPb1ZeVZwjI2OMBnoyGxSv2xyxIiz8z9Gg2P2j2kZ9Qi3j8Jbd+ePdV657tSJY6HbX V4WJ9YzFVvgYiSGWt3lRBQ8Fzh6qaKL9gJFxSZ5lmiu9zBmMqBw2XhJu/bi3CmGSDla7 ypOA== 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 :message-id:date:subject:cc:to:from; bh=6ISq7jx2wRwRbUgKfbp5FIcdi9U1CktDA4Rb+13XQtE=; b=PCr2Q+miUNhUeCkmpEuOIV7IdKYZINa9KleICU9G6G2vRObrD23lvFO+3peTpTufmg ZMgB3v6N2jnve5qEcJv5SlPmzwk1BRYkA5Q82se6m5HNkP5vH6V8r81u27MHyIx6rVQs dRMUbN75rHchOwdzubvteZJYJZmgRn8uA49C+5mmBHsdY3Z2lQePN9Hb55Ui2KQIv+B0 8ECXgZBEauc2wWEWVyZdwOpoEjg3bqyzT6HWybgt2OMupCgsNHLJ6DHr8kIJ7vA4GEJJ oAmwr/5xIBsdc8FU4chcTmIaJ+FnWW1rlf4Fk/leOLw1lUVAQQ8N6Q1UUJdQzyAybQjw OlgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x123-20020a626381000000b0063b4e9c4f49si901775pfb.387.2023.04.13.02.59.10; Thu, 13 Apr 2023 02:59:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229593AbjDMJ6j (ORCPT + 99 others); Thu, 13 Apr 2023 05:58:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229977AbjDMJ6h (ORCPT ); Thu, 13 Apr 2023 05:58:37 -0400 Received: from hust.edu.cn (mail.hust.edu.cn [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 322997692; Thu, 13 Apr 2023 02:58:35 -0700 (PDT) Received: from localhost.localdomain ([172.16.0.254]) (user=u202112087@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 33D9vs1T014113-33D9vs1U014113 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 13 Apr 2023 17:58:15 +0800 From: Guoqing Cai To: "Theodore Ts'o" , Jan Kara Cc: HUST OS Kernel Contribution , Guoqing Cai , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] fs: jbd2: fix an incorrect warn log Date: Thu, 13 Apr 2023 17:57:39 +0800 Message-Id: <20230413095740.2222066-1-u202112087@hust.edu.cn> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-FEAS-AUTH-USER: u202112087@hust.edu.cn X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, 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-ext4@vger.kernel.org In jbd2_journal_load(), when journal_reset fails, it prints an incorrect warn log. Fix this by changing the goto statement to return statement. Also, return actual error code from jbd2_journal_recover() and journal_reset(). Signed-off-by: Guoqing Cai --- changelog: - Add a warning log when journal_reset failed. - Return the actual error code. --- fs/jbd2/journal.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index e80c781731f8..147733dd5cc3 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -2082,8 +2082,11 @@ int jbd2_journal_load(journal_t *journal) /* Let the recovery code check whether it needs to recover any * data from the journal. */ - if (jbd2_journal_recover(journal)) - goto recovery_error; + err = jbd2_journal_recover(journal); + if (err) { + pr_warn("JBD2: journal recovery failed\n"); + return err; + } if (journal->j_failed_commit) { printk(KERN_ERR "JBD2: journal transaction %u on %s " @@ -2100,15 +2103,14 @@ int jbd2_journal_load(journal_t *journal) /* OK, we've finished with the dynamic journal bits: * reinitialise the dynamic contents of the superblock in memory * and reset them on disk. */ - if (journal_reset(journal)) - goto recovery_error; + err = journal_reset(journal); + if (err) { + pr_warn("JBD2: journal reset failed\n"); + return err; + } journal->j_flags |= JBD2_LOADED; return 0; - -recovery_error: - printk(KERN_WARNING "JBD2: recovery failed\n"); - return -EIO; } /** -- 2.40.0