|
@@ -7193,10 +7193,7 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
|
|
|
BUG_ON(ret); /* -ENOMEM */
|
|
|
}
|
|
|
|
|
|
- if (!last_ref)
|
|
|
- return;
|
|
|
-
|
|
|
- if (btrfs_header_generation(buf) == trans->transid) {
|
|
|
+ if (last_ref && btrfs_header_generation(buf) == trans->transid) {
|
|
|
struct btrfs_block_group_cache *cache;
|
|
|
|
|
|
if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) {
|
|
@@ -7227,11 +7224,13 @@ out:
|
|
|
add_pinned_bytes(fs_info, buf->len, btrfs_header_level(buf),
|
|
|
root->root_key.objectid);
|
|
|
|
|
|
- /*
|
|
|
- * Deleting the buffer, clear the corrupt flag since it doesn't matter
|
|
|
- * anymore.
|
|
|
- */
|
|
|
- clear_bit(EXTENT_BUFFER_CORRUPT, &buf->bflags);
|
|
|
+ if (last_ref) {
|
|
|
+ /*
|
|
|
+ * Deleting the buffer, clear the corrupt flag since it doesn't
|
|
|
+ * matter anymore.
|
|
|
+ */
|
|
|
+ clear_bit(EXTENT_BUFFER_CORRUPT, &buf->bflags);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/* Can return -ENOMEM */
|