linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: zhanchengbin <zhanchengbin1@huawei.com>
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.
Date: Sat, 25 Mar 2023 10:13:18 -0700	[thread overview]
Message-ID: <20230325171318.GA16162@frogsfrogsfrogs> (raw)
In-Reply-To: <20230325065652.2111384-3-zhanchengbin1@huawei.com>

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 <zhanchengbin1@huawei.com>
> ---
>  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
> 

  reply	other threads:[~2023-03-25 17:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-25  6:56 [PATCH 0/2] Add some msg for io error zhanchengbin
2023-03-25  6:56 ` [PATCH 1/2] lib/ext2fs: add error handle in unix_flush and unix_write_byte zhanchengbin
2023-03-25  6:56 ` [PATCH 2/2] e2fsck: add sync error handle to e2fsck zhanchengbin
2023-03-25 17:13   ` Darrick J. Wong [this message]
2023-03-30  3:00     ` zhanchengbin
2023-03-26 14:31 ` [PATCH 0/2] Add some msg for io error Theodore Ts'o
2023-03-30  2:56   ` zhanchengbin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230325171318.GA16162@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=linfeilong@huawei.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=liuzhiqiang26@huawei.com \
    --cc=louhongxiang@huawei.com \
    --cc=tytso@mit.edu \
    --cc=zhanchengbin1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).