mbox series

[0/2] btrfs: fix direct IO writes with nowait and dsync iocb not syncing

Message ID cover.1667215075.git.fdmanana@suse.com (mailing list archive)
Headers show
Series btrfs: fix direct IO writes with nowait and dsync iocb not syncing | expand

Message

Filipe Manana Oct. 31, 2022, 11:43 a.m. UTC
From: Filipe Manana <fdmanana@suse.com>

This fixes direct IO writes with nowait and dsync not getting synced after
the writes complete (except when we fallback to blocking context). The first
patch is the fix, while the second one only updates a comment that is now
stale after 6.1-rc1.

Patch only applies to current misc-next, because a function prototype
declaration was recently moved out of ctree.h into btrfs_inode.h. I left
a version that applies cleanly against 6.0.6 and 6.1-rc at:

  https://git.kernel.org/pub/scm/linux/kernel/git/fdmanana/linux.git/log/?h=async_dio_fsync_fix_6.1_6.0

Filipe Manana (2):
  btrfs: fix lost file sync on direct IO write with nowait and dsync iocb
  btrfs: update stale comment for nowait direct IO writes

 fs/btrfs/btrfs_inode.h |  5 ++++-
 fs/btrfs/file.c        | 26 ++++++++++++++++++--------
 fs/btrfs/inode.c       | 14 +++++++++++---
 3 files changed, 33 insertions(+), 12 deletions(-)

Comments

David Sterba Oct. 31, 2022, 4:26 p.m. UTC | #1
On Mon, Oct 31, 2022 at 11:43:54AM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> This fixes direct IO writes with nowait and dsync not getting synced after
> the writes complete (except when we fallback to blocking context). The first
> patch is the fix, while the second one only updates a comment that is now
> stale after 6.1-rc1.

The nowait + dsync combination is proably not a typical one but maybe
there are use cases I don't know about. Anyway, thanks for fixing it.

> Patch only applies to current misc-next, because a function prototype
> declaration was recently moved out of ctree.h into btrfs_inode.h. I left
> a version that applies cleanly against 6.0.6 and 6.1-rc at:
> 
>   https://git.kernel.org/pub/scm/linux/kernel/git/fdmanana/linux.git/log/?h=async_dio_fsync_fix_6.1_6.0

Great, thanks, that helps.