Skip to content

btrfs-progs: Fix delayed ref leakage

Qu Wenruo linux-btrfs 1 version Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest2 patches 7 repliesApplied

Changes in v2 from the cover letter

- Use a loop to exhaust both delayed refs and dirty block groups Thanks Nikolay for pointing out the feedback between them.

- Add a new patch to reduce above feedback

- Handle the error from btrfs_write_dirty_block_groups()

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2btrfs-progs: Exhaust delayed refs and dirty block groups to prevent delayed refs losttransaction.c+21 -62 replies
2/2btrfs-progs: Avoid unnecessary block group item COW if the content hasn't changedextent-tree.c+25 -15 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchNikolay Borisov
1/2R-b
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-progs: Fix delayed ref leakage

We have several bug reports of btrfs-convert failure in btrfs_run_delayed_refs().

The bug turns out to be a incorrect backport of delayed ref handling in transaction commit.

In kernel we have a loop to exhause both delayed refs and dirty blocks, as btrfs_write_dirty_block_groups() can generate new delayed refs, while btrfs_run_delayed_refs() can re-dirty block groups.

This feedback could cause missing delayed refs, and bite later transaction just like the btrfs-convert report.

Furthermore, such lost delayed refs causes memory leakage and reserved space leakage, the later one can be detected by commit c31edf610cbe ("btrfs-progs: Fix false ENOSPC alert by tracking used space correctly").

The first patch will fix the long existing bug.

The second patch will try to reduce the feedback between btrfs_write_dirty_block_groups() and btrfs_run_delayed_refs().

Changelog:
v2:
- Use a loop to exhaust both delayed refs and dirty block groups Thanks Nikolay for pointing out the feedback between them.

- Add a new patch to reduce above feedback

- Handle the error from btrfs_write_dirty_block_groups()

Qu Wenruo (2):
btrfs-progs: Exhaust delayed refs and dirty block groups to prevent
delayed refs lost
btrfs-progs: Avoid unnecessary block group item COW if the content
hasn't changed

 extent-tree.c | 26 +++++++++++++++++++++++++-
 transaction.c | 27 +++++++++++++++++++++------
 2 files changed, 46 insertions(+), 7 deletions(-)
Signature · 1 line
2.22.0