Merge tag 'for-6.10-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux

Pull btrfs fix from David Sterba:
 "A fixup for a recent fix that prevents an infinite loop during block
  group reclaim.

  Unfortunately it introduced an unsafe way of updating block group list
  and could race with relocation. This could be hit on fast devices when
  relocation/balance does not have enough space"

* tag 'for-6.10-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
  btrfs: fix adding block group to a reclaim list and the unused list during reclaim
This commit is contained in:
Linus Torvalds
2024-07-01 12:48:28 -07:00
+11 -2
View File
@@ -1924,8 +1924,17 @@ void btrfs_reclaim_bgs_work(struct work_struct *work)
next:
if (ret) {
/* Refcount held by the reclaim_bgs list after splice. */
btrfs_get_block_group(bg);
list_add_tail(&bg->bg_list, &retry_list);
spin_lock(&fs_info->unused_bgs_lock);
/*
* This block group might be added to the unused list
* during the above process. Move it back to the
* reclaim list otherwise.
*/
if (list_empty(&bg->bg_list)) {
btrfs_get_block_group(bg);
list_add_tail(&bg->bg_list, &retry_list);
}
spin_unlock(&fs_info->unused_bgs_lock);
}
btrfs_put_block_group(bg);