]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
btrfs: btrfs_drop_snapshot should return int
authorJeff Mahoney <jeffm@suse.com>
Tue, 4 Oct 2011 03:22:41 +0000 (23:22 -0400)
committerDavid Sterba <dsterba@suse.cz>
Thu, 22 Mar 2012 00:45:36 +0000 (01:45 +0100)
Commit cb1b69f4 (Btrfs: forced readonly when btrfs_drop_snapshot() fails)
made btrfs_drop_snapshot return void because there were no callers checking
the return value. That is the wrong order to handle error propogation since
the caller will have no idea that an error has occured and continue on
as if nothing went wrong.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
fs/btrfs/ctree.h
fs/btrfs/extent-tree.c
fs/btrfs/relocation.c
fs/btrfs/transaction.c

index 30c5a247ab2b4b2899f776eaf764a80486c471df..f6bca05a4b4c37acae6d02f0014a4c95b66f47b2 100644 (file)
@@ -2661,9 +2661,9 @@ static inline int btrfs_next_item(struct btrfs_root *root, struct btrfs_path *p)
 }
 int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path);
 int btrfs_leaf_free_space(struct btrfs_root *root, struct extent_buffer *leaf);
-void btrfs_drop_snapshot(struct btrfs_root *root,
-                        struct btrfs_block_rsv *block_rsv, int update_ref,
-                        int for_reloc);
+int __must_check btrfs_drop_snapshot(struct btrfs_root *root,
+                                    struct btrfs_block_rsv *block_rsv,
+                                    int update_ref, int for_reloc);
 int btrfs_drop_subtree(struct btrfs_trans_handle *trans,
                        struct btrfs_root *root,
                        struct extent_buffer *node,
index 0daa1df1643986fb541e3c22d95f74dda1e850ba..cd6f8ae0a78df27277d12734301d4a63c2855f7b 100644 (file)
@@ -6734,7 +6734,7 @@ static noinline int walk_up_tree(struct btrfs_trans_handle *trans,
  * also make sure backrefs for the shared block and all lower level
  * blocks are properly updated.
  */
-void btrfs_drop_snapshot(struct btrfs_root *root,
+int btrfs_drop_snapshot(struct btrfs_root *root,
                         struct btrfs_block_rsv *block_rsv, int update_ref,
                         int for_reloc)
 {
@@ -6902,7 +6902,7 @@ out_free:
 out:
        if (err)
                btrfs_std_error(root->fs_info, err);
-       return;
+       return err;
 }
 
 /*
index 5e89a5ea692f852702aabfb4c49cc9f334322159..a87678ead6111246e306c66a935bf8710f771618 100644 (file)
@@ -2272,7 +2272,8 @@ again:
                } else {
                        list_del_init(&reloc_root->root_list);
                }
-               btrfs_drop_snapshot(reloc_root, rc->block_rsv, 0, 1);
+               ret = btrfs_drop_snapshot(reloc_root, rc->block_rsv, 0, 1);
+               BUG_ON(ret < 0);
        }
 
        if (found) {
index 6e256d90fd2f80941d298d227d5316070f2e5781..fb5cd5a4adba881966a8414ff11bc11d86f061ad 100644 (file)
@@ -1387,6 +1387,8 @@ int btrfs_clean_old_snapshots(struct btrfs_root *root)
        spin_unlock(&fs_info->trans_lock);
 
        while (!list_empty(&list)) {
+               int ret;
+
                root = list_entry(list.next, struct btrfs_root, root_list);
                list_del(&root->root_list);
 
@@ -1394,9 +1396,10 @@ int btrfs_clean_old_snapshots(struct btrfs_root *root)
 
                if (btrfs_header_backref_rev(root->node) <
                    BTRFS_MIXED_BACKREF_REV)
-                       btrfs_drop_snapshot(root, NULL, 0, 0);
+                       ret = btrfs_drop_snapshot(root, NULL, 0, 0);
                else
-                       btrfs_drop_snapshot(root, NULL, 1, 0);
+                       ret =btrfs_drop_snapshot(root, NULL, 1, 0);
+               BUG_ON(ret < 0);
        }
        return 0;
 }