lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 25 Mar 2023 10:13:18 -0700
From:   "Darrick J. Wong" <djwong@...nel.org>
To:     zhanchengbin <zhanchengbin1@...wei.com>
Cc:     tytso@....edu, linux-ext4@...r.kernel.org, linfeilong@...wei.com,
        louhongxiang@...wei.com, liuzhiqiang26@...wei.com
Subject: Re: [PATCH 2/2] e2fsck: add sync error handle to e2fsck.

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@...wei.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
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ