]> git.hungrycats.org Git - linux/commitdiff
Revert "Btrfs: do not start a transaction at iterate_extent_inodes()"
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Wed, 20 Nov 2019 22:03:06 +0000 (17:03 -0500)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Thu, 21 Nov 2019 02:29:12 +0000 (21:29 -0500)
due to suspected crashing interactions with balance.

This reverts commit b658422ed8f4524e9bde401c10280980f0c148fe.

(cherry picked from commit 34ce7a72ce5416a50889652e24a28d8e787f7415)

fs/btrfs/backref.c

index 69f8ab4d91f2ba9983c04a08b26ee16075224c74..42129f2e299d96928b7d49b3e096d16f803a1fc4 100644 (file)
@@ -1916,19 +1916,13 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
                        extent_item_objectid);
 
        if (!search_commit_root) {
-               trans = btrfs_attach_transaction(fs_info->extent_root);
-               if (IS_ERR(trans)) {
-                       if (PTR_ERR(trans) != -ENOENT &&
-                           PTR_ERR(trans) != -EROFS)
-                               return PTR_ERR(trans);
-                       trans = NULL;
-               }
-       }
-
-       if (trans)
+               trans = btrfs_join_transaction(fs_info->extent_root);
+               if (IS_ERR(trans))
+                       return PTR_ERR(trans);
                btrfs_get_tree_mod_seq(fs_info, &tree_mod_seq_elem);
-       else
+       } else {
                down_read(&fs_info->commit_root_sem);
+       }
 
        ret = btrfs_find_all_leafs(trans, fs_info, extent_item_objectid,
                                   tree_mod_seq_elem.seq, &refs,
@@ -1961,7 +1955,7 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
 
        free_leaf_list(refs);
 out:
-       if (trans) {
+       if (!search_commit_root) {
                btrfs_put_tree_mod_seq(fs_info, &tree_mod_seq_elem);
                btrfs_end_transaction(trans);
        } else {