From mboxrd@z Thu Jan 1 00:00:00 1970 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 BF8DFC6FD1C for ; Sat, 25 Mar 2023 17:13:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230038AbjCYRNW (ORCPT ); Sat, 25 Mar 2023 13:13:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjCYRNU (ORCPT ); Sat, 25 Mar 2023 13:13:20 -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 16544EC4B for ; Sat, 25 Mar 2023 10:13:19 -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 8946560C86 for ; Sat, 25 Mar 2023 17:13:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5C08C433D2; Sat, 25 Mar 2023 17:13:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679764398; bh=q+ORIbz2Assz2rdlyn8GCpkWKvOZ73XapqfkGHfnDBQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KQXpxZgySK2Fiz5MmzJzAsA1zaC2o1rrb+hN3H2BVWsjMMUEjQRwLrcILRkAGsN+a FfUx5VbxSRhE109AmooHpHABNck19uENB3q+eb9HcrfmjFFa4ygMi3MZi30uDHliXH 9/DuHKdFVuFsaOYjIWGTkjU3GMPbJQZ5TkQQeG05yFW4wvpQBH6Xq+HFeZ4K9IHfq0 GG6vrVJYbTSN9JrdUX4BruOrWTuQcyqYdX7xVWzkZtbwmggMDCq09eAC89E/3/lFpn 2VsBy1MOljsN+wtF3w0FqgB7LJ07TKH0u/sip+pcCkyqaV3GAOntnZPoFTdg94kSKn rJCPbn57mtxZg== Date: Sat, 25 Mar 2023 10:13:18 -0700 From: "Darrick J. Wong" To: zhanchengbin Cc: tytso@mit.edu, linux-ext4@vger.kernel.org, linfeilong@huawei.com, louhongxiang@huawei.com, liuzhiqiang26@huawei.com Subject: Re: [PATCH 2/2] e2fsck: add sync error handle to e2fsck. Message-ID: <20230325171318.GA16162@frogsfrogsfrogs> References: <20230325065652.2111384-1-zhanchengbin1@huawei.com> <20230325065652.2111384-3-zhanchengbin1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230325065652.2111384-3-zhanchengbin1@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Sat, Mar 25, 2023 at 02:56:52PM +0800, zhanchengbin wrote: > If fsync fails during fsck, it is silent and users will not perceive it, so > a function to handle fsync failure should be added to fsck. > > Signed-off-by: zhanchengbin > --- > e2fsck/ehandler.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/e2fsck/ehandler.c b/e2fsck/ehandler.c > index 71ca301c..ae35f3ef 100644 > --- a/e2fsck/ehandler.c > +++ b/e2fsck/ehandler.c > @@ -118,6 +118,29 @@ static errcode_t e2fsck_handle_write_error(io_channel channel, > return error; > } > > +static errcode_t e2fsck_handle_sync_error(io_channel channel, > + errcode_t error) > +{ > + ext2_filsys fs = (ext2_filsys) channel->app_data; > + e2fsck_t ctx; > + > + ctx = (e2fsck_t) fs->priv_data; > + if (ctx->flags & E2F_FLAG_EXITING) > + return 0; > + Nit: ^^^ unnecessary indentation > + if (operation) > + printf(_("Error sync (%s) while %s. "), I think we should be more explicit that *fsync* failed: "Error during fsync of dirty metadata while %s: %s", operation, error_message(...)? > + error_message(error), operation); > + else > + printf(_("Error sync (%s). "), > + error_message(error)); > + preenhalt(ctx); > + if (ask(ctx, _("Ignore error"), 1)) ask_yn()? Not sure what we're asking about here, or what happens if you answer NO? Unless we're using a redo file, dirty metadata flush has failed so we might as well keep going, right? --D > + return 0; > + > + return error; > +} > + > const char *ehandler_operation(const char *op) > { > const char *ret = operation; > @@ -130,4 +153,5 @@ void ehandler_init(io_channel channel) > { > channel->read_error = e2fsck_handle_read_error; > channel->write_error = e2fsck_handle_write_error; > + channel->sync_error = e2fsck_handle_sync_error; > } > -- > 2.31.1 >