Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2207257rwl; Thu, 13 Apr 2023 03:15:49 -0700 (PDT) X-Google-Smtp-Source: AKy350ZY5pLH/kDcHzNgAo5JftnSm/R16MUuqxSCiIEZF3E7vB+adC9r10w22dZ/nlnSm7Ll2NmB X-Received: by 2002:a17:907:238d:b0:94e:83d3:1b51 with SMTP id vf13-20020a170907238d00b0094e83d31b51mr1232685ejb.23.1681380948868; Thu, 13 Apr 2023 03:15:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681380948; cv=none; d=google.com; s=arc-20160816; b=iC01uQMdrLBSpeBdrL58F8tK4XtUc4DVZ75IJCTZT5VfUWlMhO65cf9rlYPL7hGy7k zoNRSdYUOgA6oWgJyuOF8IvyC6Oy9XNHPSjfRT3BRhznplFjDHkt6WuwqqM1+ELeAGB8 Z7QAZM5YXNN4o4AU2g/gHHRGrrjBCZkoluUkae2nF8MkHvX3vP2lslmWe3GX9l81Ywr8 GJYR+B2s8qdzRMTHOJQXfGe1WdhwTNUevxzYpuLjozNW49+Goi7eMgcuCeYE8BhjFYPV 7YSbEB+qRyK3y9f8QEW1IdHuvrPCrhE1drPN19u5xrv+y+npWiWSu/TYJ0URmL35YIBT qyQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=hf55BhKINP1L+Xd3BxYZAkmZBMcD2m94S6WBz92mpIY=; b=jY/zbaFRVHzegSnFbkkIBsc7aRQjn4ihOodP+V31V4gxXr8aqzO1sjZuDwd/CDOB6p 928pxPb3OLRSJUrLMyCBjCR5Hw8zcxX9f52SDvpZ1ms7jBW/cmwMfmFIOlA9oaOiCmXQ tSQARf8TEiAPNaRCbdk4g9PeDYGF5EQsD9mD6rJ4b6Z453K6tU2e0xStYynq1h9ijWLQ 3oTDaCOOHxi1K9u/TJL/wFrEbTBZHE5swdB1uz96RBcOvjT1GcQpop5amuEWXEEpRHxW No1FTPlLCaW+5dd99o/mWkJyryO+oOCeW4WAnXRBXUuKZIqED2BDviXdsSvP+FyYeUuM GRGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="UIfw/TRh"; dkim=neutral (no key) header.i=@suse.cz header.b=1H90D2Hd; 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 wg12-20020a1709078f0c00b00926b7e35cf0si1470648ejc.165.2023.04.13.03.15.22; Thu, 13 Apr 2023 03:15:48 -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; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="UIfw/TRh"; dkim=neutral (no key) header.i=@suse.cz header.b=1H90D2Hd; 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 S230400AbjDMKOx (ORCPT + 99 others); Thu, 13 Apr 2023 06:14:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230403AbjDMKM3 (ORCPT ); Thu, 13 Apr 2023 06:12:29 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60D929750; Thu, 13 Apr 2023 03:12:04 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 585052183F; Thu, 13 Apr 2023 10:12:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1681380722; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hf55BhKINP1L+Xd3BxYZAkmZBMcD2m94S6WBz92mpIY=; b=UIfw/TRhEbPKpHQsYQvxYyuOxsr68jxK5JLtJqz5eBjNtjnyaIZ94sUB5vEh+hltzgan64 FuU1jHF9DzYL/owjiSSO12TP7OpCn9ES7lNdnBw700UtT096fcoq+j1ZrCkiqtd9oSgXoq DxYXN6yaT2DxWVO8nfv91MeRuEg3TOc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1681380722; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hf55BhKINP1L+Xd3BxYZAkmZBMcD2m94S6WBz92mpIY=; b=1H90D2HdSCUPQAnZmtD5OifPVpItgik2eloaM60sMcy3xMIKBTqWQtueinX1bR/hz93qR+ 28g9IoiiYLYnlTDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 39B971390E; Thu, 13 Apr 2023 10:12:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id jXGMDXLVN2TyQwAAMHmgww (envelope-from ); Thu, 13 Apr 2023 10:12:02 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 932CAA0732; Thu, 13 Apr 2023 12:12:01 +0200 (CEST) Date: Thu, 13 Apr 2023 12:12:01 +0200 From: Jan Kara To: Guoqing Cai Cc: Theodore Ts'o , Jan Kara , HUST OS Kernel Contribution , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] fs: jbd2: fix an incorrect warn log Message-ID: <20230413101201.gqtqhuecra3fk7x4@quack3> References: <20230413095740.2222066-1-u202112087@hust.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230413095740.2222066-1-u202112087@hust.edu.cn> X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_SOFTFAIL,URIBL_BLOCKED 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 On Thu 13-04-23 17:57:39, Guoqing Cai wrote: > 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 Looks good. Feel free to add: Reviewed-by: Jan Kara Honza > --- > 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 > -- Jan Kara SUSE Labs, CR