Skip to content

btrfs: fix deadlock with fsync and full sync

Josef Bacik linux-btrfs 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 2 repliesIn review
  2. v12 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Make btrfs_sync_file also use the new BTRFS_LOG_FORCE_COMMIT define.
- Adjust the title of the second patch

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs: make the return value for log syncing consistentfs/btrfs/file.c fs/btrfs/tree-log.c fs/btrfs/tree-log.h+13 -100 replies
2/2btrfs: fix deadlock with fsync+fiemap+transaction commitfs/btrfs/file.c+52 -150 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchFilipe Manana
SeriesR-b
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] btrfs: fix deadlock with fsync and full sync

v1->v2:
- Make btrfs_sync_file also use the new BTRFS_LOG_FORCE_COMMIT define.
- Adjust the title of the second patch

--- Original email ---
Hello,

We've hit a pretty convoluted deadlock in production that Omar tracked down with drgn. I've described the deadlock in the second patch, but generally it's a lock inversion where we have an existing dependency of extent lock -> transaction, but in fsync in a few cases we can end up with transaction -> extent lock, and the expected hilarity ensues. Thanks,

Josef

Josef Bacik (2):
btrfs: make the return value for log syncing consistent
btrfs: fix deadlock with fsync+fiemap+transaction commit

 fs/btrfs/file.c     | 69 ++++++++++++++++++++++++++++++++++-----------
 fs/btrfs/tree-log.c | 18 ++++++------
 fs/btrfs/tree-log.h |  3 ++
 3 files changed, 65 insertions(+), 25 deletions(-)
Signature · 1 line
2.26.3