public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Gianfranco <gianfranco.dutka@arista.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH]     fat: device-level-flush-after-sync
Date: Thu, 15 Sep 2022 03:05:32 +0900	[thread overview]
Message-ID: <874jx9x24z.fsf@mail.parknet.co.jp> (raw)
In-Reply-To: <20220914174015.7158-1-gianfranco.dutka@arista.com> (Gianfranco's message of "Wed, 14 Sep 2022 10:40:14 -0700")

Gianfranco <gianfranco.dutka@arista.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@arista.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@mail.parknet.co.jp>

  reply	other threads:[~2022-09-14 18:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14 17:40 [PATCH] fat: device-level-flush-after-sync Gianfranco
2022-09-14 18:05 ` OGAWA Hirofumi [this message]
2022-09-15 13:00 ` kernel test robot
2022-09-15 20:21 ` kernel test robot

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=874jx9x24z.fsf@mail.parknet.co.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=gianfranco.dutka@arista.com \
    --cc=linux-kernel@vger.kernel.org \
    /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