mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: liubaolin <liubaolin12138@163.com>
To: DaeMyung Kang <charsyam@gmail.com>,
	Namjae Jeon <linkinjeon@kernel.org>,
	Hyunchul Lee <hyc.lee@gmail.com>
Cc: ntfs@lists.linux.dev, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH 1/2] ntfs: report block device flush failures from fsync
Date: Wed, 14 Oct 2026 07:24:38 +0800	[thread overview]
Message-ID: <8e59b334-696a-4e7c-8acd-625ad18239b6@163.com> (raw)
In-Reply-To: <20261013145846.56415-2-charsyam@gmail.com>



在 2026/10/13 22:58, DaeMyung Kang 写道:
> ntfs_file_fsync() calls blkdev_issue_flush() after writeback but discards
> its return value. If the device cannot flush its write cache, fsync()
> reports success even though the file is not guaranteed to be durable.
> 
> Reproduce this with QEMU blkdebug failing flush_to_disk with -EIO.
> On ntfs-next at 04fb910da2c8, a kretprobe recorded -EIO from
> blkdev_issue_flush() while fsync() returned 0. With this change,
> fsync() returns -EIO and logs the failure. The syncfs() path already
> reports this error.
> 
> Fixes: 9c87959601e8 ("ntfs: update file operations")
> Cc: stable@vger.kernel.org
> Signed-off-by: DaeMyung Kang <charsyam@gmail.com>
> ---
>   fs/ntfs/file.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
> index 58afd310d57b..afc2efb4b699 100644
> --- a/fs/ntfs/file.c
> +++ b/fs/ntfs/file.c
> @@ -417,14 +417,14 @@ int ntfs_file_fsync(struct file *filp, loff_t start, loff_t end,
>   	err = sync_blockdev(vi->i_sb->s_bdev);
>   	if (unlikely(err && !ret))
>   		ret = err;
> +	if (!ret)
> +		ret = blkdev_issue_flush(vi->i_sb->s_bdev);
>   	if (likely(!ret))
>   		ntfs_debug("Done.");
>   	else
>   		ntfs_warning(vi->i_sb,
>   				"Failed to f%ssync inode 0x%llx.  Error %u.",
>   				datasync ? "data" : "", ni->mft_no, -ret);
> -	if (!ret)
> -		blkdev_issue_flush(vi->i_sb->s_bdev);
>   	return ret;
>   }
>   


Looks good to me.

Reviewed-by: Baolin Liu <liubaolin@kylinos.cn>


  reply	other threads:[~2026-10-13 23:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 14:58 [PATCH 0/2] ntfs: handle block device cache flush in fsync paths DaeMyung Kang
2026-10-13 14:58 ` [PATCH 1/2] ntfs: report block device flush failures from fsync DaeMyung Kang
2026-10-13 23:24   ` liubaolin [this message]
2026-10-13 14:58 ` [PATCH 2/2] ntfs: flush the block device when syncing a directory DaeMyung Kang
2026-10-13 23:24   ` liubaolin
2026-10-13 23:24 ` [PATCH 0/2] ntfs: handle block device cache flush in fsync paths liubaolin

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=8e59b334-696a-4e7c-8acd-625ad18239b6@163.com \
    --to=liubaolin12138@163.com \
    --cc=charsyam@gmail.com \
    --cc=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs@lists.linux.dev \
    --cc=stable@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

all inboxes | Powered by JetHome®