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:   Thu, 15 Sep 2022 03:05:32 +0900
From:   OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
To:     Gianfranco <gianfranco.dutka@...sta.com>
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH]     fat: device-level-flush-after-sync

Gianfranco <gianfranco.dutka@...sta.com> writes:

>     This patch forces a device-level flush after the generic Linux
>     code for sync has run.
>
>     The kernel depends upon filesystem-specific code to flush when
>     the filesystem itself thinks it is necessary, and otherwise
>     does nothing.  Someone expecting sync to behave as expected
>     might be in for a rude surprise.
>
>     The usual caveats apply:  Devices that do not implement flush
>     or whose implementation is buggy will not behave well.  IO
>     that occurs after the sync will not be flushed.

Does this patch fix the issue? After the ->sync_fs(), bdev page caches
including FAT data are still dirty, isn't it?

Thanks.

> Signed-off-by: Ken Kofman <gianfranco.dutka@...sta.com>
>
> ---
>  fs/fat/inode.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/fs/fat/inode.c b/fs/fat/inode.c
> index a38238d75c08..ddaed94ee48f 100644
> --- a/fs/fat/inode.c
> +++ b/fs/fat/inode.c
> @@ -823,6 +823,14 @@ static int fat_remount(struct super_block *sb, int *flags, char *data)
>  	return 0;
>  }
>  
> +static int fat_sync_fs(struct super_block *sb, int wait)
> +{
> +	if (wait)
> +		return blkdev_issue_flush(sb->s_bdev, GFP_KERNEL, NULL);
> +	else
> +		return 0;
> +}
> +
>  static int fat_statfs(struct dentry *dentry, struct kstatfs *buf)
>  {
>  	struct super_block *sb = dentry->d_sb;
> @@ -937,6 +945,7 @@ static const struct super_operations fat_sops = {
>  	.put_super	= fat_put_super,
>  	.statfs		= fat_statfs,
>  	.remount_fs	= fat_remount,
> +	.sync_fs        = fat_sync_fs,
>  
>  	.show_options	= fat_show_options,
>  };

-- 
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ