]> git.hungrycats.org Git - linux/commitdiff
btrfs: fix race in btrfs_free_dummy_fs_info()
authorMatthew Wilcox <mawilcox@microsoft.com>
Wed, 14 Dec 2016 23:08:46 +0000 (15:08 -0800)
committerZygo Blaxell <zblaxell@thirteen.furryterror.org>
Thu, 15 Dec 2016 05:55:22 +0000 (00:55 -0500)
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.

Link: http://lkml.kernel.org/r/1480369871-5271-54-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit b35df27a39f40e39fabf1b1e9569c7b24e1add6a)

fs/btrfs/tests/btrfs-tests.c

index 471c37007cec011adaa7faa075759c6159f8da91..978546acae6722967620e3e7e5d9c4064510811b 100644 (file)
@@ -150,6 +150,7 @@ restart:
                                goto restart;
                        continue;
                }
+               slot = radix_tree_iter_next(&iter);
                spin_unlock(&fs_info->buffer_lock);
                free_extent_buffer_stale(eb);
                spin_lock(&fs_info->buffer_lock);