mbox series

[0/2] btrfs: fix a regression with concurrent DIO writes and fsync on the same fd

Message ID cover.1724972506.git.fdmanana@suse.com (mailing list archive)
Headers show
Series btrfs: fix a regression with concurrent DIO writes and fsync on the same fd | expand

Message

Filipe Manana Aug. 29, 2024, 11:09 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

Fix a recent regression when doing concurrent direct IO writes and fsync
using the same fd from multiple threads. This was reported recently by a
couple users when using QEMU, as well as syzbot. The fix is the first
patch in the series, the second one is just an improvement for some
assertions. Details in the change logs of each patch.

Filipe Manana (2):
  btrfs: fix race between direct IO write and fsync when using same fd
  btrfs: add and use helper to verify the calling task has locked the inode

 fs/btrfs/btrfs_inode.h  |  8 ++++++++
 fs/btrfs/ctree.h        |  1 -
 fs/btrfs/direct-io.c    | 16 +++-------------
 fs/btrfs/file.c         |  9 +++++++--
 fs/btrfs/ordered-data.c |  2 +-
 fs/btrfs/transaction.h  |  6 ++++++
 fs/btrfs/tree-log.c     |  2 +-
 fs/btrfs/verity.c       |  6 +++---
 fs/btrfs/xattr.c        |  2 +-
 9 files changed, 30 insertions(+), 22 deletions(-)

Comments

Josef Bacik Sept. 3, 2024, 3:50 p.m. UTC | #1
On Fri, Aug 30, 2024 at 12:09:35AM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Fix a recent regression when doing concurrent direct IO writes and fsync
> using the same fd from multiple threads. This was reported recently by a
> couple users when using QEMU, as well as syzbot. The fix is the first
> patch in the series, the second one is just an improvement for some
> assertions. Details in the change logs of each patch.
> 
> Filipe Manana (2):
>   btrfs: fix race between direct IO write and fsync when using same fd
>   btrfs: add and use helper to verify the calling task has locked the inode
> 

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef