Skip to content

btrfs: fix a couple swapfile support bugs

[email protected] linux-btrfs 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 4 repliesIn review
  2. v14 patches 6 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3btrfs: avoid checking for RO block group twice during nocow writebackfs/btrfs/inode.c+1 -31 reply
2/3btrfs: fix race between writes to swap files and scrubfs/btrfs/block-group.c fs/btrfs/block-group.h fs/btrfs/ctree.h +2 more+72 -31 reply
3/3btrfs: fix race between swap file activation and snapshot creationfs/btrfs/inode.c+19 -21 reply

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchAnand Jain
1/3R-b
2/3R-b
3/3R-b

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/3] btrfs: fix a couple swapfile support bugs

From: Filipe Manana <[email protected]>

The following patchset fixes 2 bugs with the swapfile support, where we can end up falling back to COW when writing to an active swapfile. The first patch is actually independent and just makes the nocow buffered IO path more efficient by eliminating a repeated check for a read-only block group.

V2: Removed the part of optimizing the direct IO nocow path from patch 2,
because removing the RO block group check from can_nocow_extent() would leave the buffered write path that checks if we can fallback to nocow at write time (and not writeback time), after hitting ENOSPC when attempting to reserve data space, from doing that check. The optimization can still be done, but that would require adding more context information to can_nocow_extent(), so it could know when it needs to check if the block group is RO or not - since things are a bit entangled around that function and its callers, I've left it out for now.

Filipe Manana (3):
btrfs: avoid checking for RO block group twice during nocow writeback
btrfs: fix race between writes to swap files and scrub
btrfs: fix race between swap file activation and snapshot creation

 fs/btrfs/block-group.c | 33 ++++++++++++++++++++++++++++++-
 fs/btrfs/block-group.h |  9 +++++++++
 fs/btrfs/ctree.h       |  5 +++++
 fs/btrfs/inode.c       | 44 ++++++++++++++++++++++++++++++++++++------
 fs/btrfs/scrub.c       |  9 ++++++++-
 5 files changed, 92 insertions(+), 8 deletions(-)
Signature · 1 line
2.28.0