Btrfs: do not BUG if we fail to remove the orphan item for dead snapshots
authorJosef Bacik <josef@redhat.com>
Wed, 8 Dec 2010 17:24:01 +0000 (12:24 -0500)
committerChris Mason <chris.mason@oracle.com>
Fri, 10 Dec 2010 21:29:04 +0000 (16:29 -0500)
Not being able to delete an orphan item isn't a horrible thing.  The worst that
happens is the next time around we try and do the orphan cleanup and we can't
find the referenced object and just delete the item and move on.

Signed-off-by: Josef Bacik <josef@redhat.com>
fs/btrfs/extent-tree.c

index cec05e10014281886014b1274ffe7e4e1e86a6bd..41133b064d7205c3ce9a0da31b8794e8bfad0ad3 100644 (file)
@@ -6309,9 +6309,13 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
                                           NULL, NULL);
                BUG_ON(ret < 0);
                if (ret > 0) {
-                       ret = btrfs_del_orphan_item(trans, tree_root,
-                                                   root->root_key.objectid);
-                       BUG_ON(ret);
+                       /* if we fail to delete the orphan item this time
+                        * around, it'll get picked up the next time.
+                        *
+                        * The most common failure here is just -ENOENT.
+                        */
+                       btrfs_del_orphan_item(trans, tree_root,
+                                             root->root_key.objectid);
                }
        }