Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D495C61DA4 for ; Fri, 10 Feb 2023 02:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230490AbjBJC5R (ORCPT ); Thu, 9 Feb 2023 21:57:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230061AbjBJC5F (ORCPT ); Thu, 9 Feb 2023 21:57:05 -0500 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25381663D2; Thu, 9 Feb 2023 18:57:04 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4PCdgH3YWsz4f3nTL; Fri, 10 Feb 2023 10:56:59 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP3 (Coremail) with SMTP id _Ch0CgCHgR96suVjIkgqDA--.35208S7; Fri, 10 Feb 2023 10:57:01 +0800 (CST) From: Ye Bin To: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org Cc: linux-kernel@vger.kernel.org, jack@suse.cz, Ye Bin Subject: [PATCH v2 3/6] jbd2: do extra handle when do journal recovery Date: Fri, 10 Feb 2023 11:20:41 +0800 Message-Id: <20230210032044.146115-4-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230210032044.146115-1-yebin@huaweicloud.com> References: <20230210032044.146115-1-yebin@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _Ch0CgCHgR96suVjIkgqDA--.35208S7 X-Coremail-Antispam: 1UD129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gou0bp/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ye Bin Ext4 file system's super block in journal maybe not uptodate, when file system has error, we need set error information when do recover uper block. Signed-off-by: Ye Bin --- fs/jbd2/recovery.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c index 8286a9ec122f..83b1a9689984 100644 --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c @@ -309,6 +309,15 @@ int jbd2_journal_recover(journal_t *journal) return 0; } + if (journal->j_replay_prepare_callback) { + err = journal->j_replay_prepare_callback(journal); + if (err) { + jbd2_debug(1, "JBD2: failed to prepare replay %d", + err); + return err; + } + } + err = do_one_pass(journal, &info, PASS_SCAN); if (!err) err = do_one_pass(journal, &info, PASS_REVOKE); @@ -335,6 +344,10 @@ int jbd2_journal_recover(journal_t *journal) if (!err) err = err2; } + + if (journal->j_replay_end_callback) + journal->j_replay_end_callback(journal); + return err; } @@ -687,6 +700,20 @@ static int do_one_pass(journal_t *journal, *((__be32 *)nbh->b_data) = cpu_to_be32(JBD2_MAGIC_NUMBER); } + if (unlikely(journal->j_replay_callback)) { + err = journal->j_replay_callback( + journal, nbh); + if (err) { + printk(KERN_ERR + "JBD2: replay " + "call back " + "failed.\n"); + unlock_buffer(nbh); + brelse(obh); + brelse(nbh); + goto failed; + } + } BUFFER_TRACE(nbh, "marking dirty"); set_buffer_uptodate(nbh); -- 2.31.1