Skip to contentSkip to conversation

btrfs: fix race in btrfs_free_dummy_fs_info()

PATCH New [email protected] 1 participant 1 message Dec 14, 2016 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 97/114 btrfs: fix race in btrfs_free_dummy_fs_info()

From: Matthew Wilcox <[email protected]>
Subject: btrfs: fix race in btrfs_free_dummy_fs_info()

We drop the lock which protects the radix tree, so we must call radix_tree_iter_next() in order to avoid a modification to the tree invalidating the iterator state.

---

 fs/btrfs/tests/btrfs-tests.c |    1 +
 1 file changed, 1 insertion(+)
fs/btrfs/tests/btrfs-tests.c renamed from fs/btrfs/tests/btrfs-tests.c~btrfs-fix-race-in-btrfs_free_dummy_fs_info +1 -0
diff -puN fs/btrfs/tests/btrfs-tests.c~btrfs-fix-race-in-btrfs_free_dummy_fs_info fs/btrfs/tests/btrfs-tests.c
@@ -162,6 +162,7 @@ void btrfs_free_dummy_fs_info(struct btr
 				slot = radix_tree_iter_retry(&iter);
 			continue;
 		}
+		slot = radix_tree_iter_next(&iter);
 		spin_unlock(&fs_info->buffer_lock);
 		free_extent_buffer_stale(eb);
 		spin_lock(&fs_info->buffer_lock);

_