Skip to content

Commit

Permalink
Disable spill block processing.
Browse files Browse the repository at this point in the history
This patch might allow some pools with corrupted dnodes to be imported and
for their filesystems to be destroyed.  All spill blocks are ignored by
virtue of defining DNODE_FLAG_SPILL_BLKPTR as 0.  The only other change
is to remove a number of assertions which are typically triggered when
removing filesystems.

WARNING: VERY DANGEROUS!  I've given it a single round of testing
consisting of:

  - Given an existing filesystem with xattr=sa and a file(s) with long
    xattrs needing spill blocks.
  - Destroy the filesystem with this patch.  - Run zdb to verify the
    leaked space.
  • Loading branch information
dweeezil committed Nov 29, 2014
1 parent c944be5 commit 35660b3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/sys/dnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ enum dnode_dirtycontext {
#define DNODE_FLAG_USERUSED_ACCOUNTED (1<<1)

/* Does dnode have a SA spill blkptr in bonus? */
#define DNODE_FLAG_SPILL_BLKPTR (1<<2)
#define DNODE_FLAG_SPILL_BLKPTR 0

typedef struct dnode_phys {
uint8_t dn_type; /* dmu_object_type_t */
Expand Down
4 changes: 4 additions & 0 deletions module/zfs/bptree.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ bptree_free(objset_t *os, uint64_t obj, dmu_tx_t *tx)
VERIFY3U(0, ==, dmu_bonus_hold(os, obj, FTAG, &db));
bt = db->db_data;
ASSERT3U(bt->bt_begin, ==, bt->bt_end);
#if 0
ASSERT0(bt->bt_bytes);
ASSERT0(bt->bt_comp);
ASSERT0(bt->bt_uncomp);
#endif
dmu_buf_rele(db, FTAG);

return (dmu_object_free(os, obj, tx));
Expand Down Expand Up @@ -290,9 +292,11 @@ bptree_iterate(objset_t *os, uint64_t obj, boolean_t free, bptree_itor_t func,
ba.ba_phys->bt_uncomp = 0;
}

#if 0
ASSERT0(ba.ba_phys->bt_bytes);
ASSERT0(ba.ba_phys->bt_comp);
ASSERT0(ba.ba_phys->bt_uncomp);
#endif
}

dmu_buf_rele(db, FTAG);
Expand Down
2 changes: 2 additions & 0 deletions module/zfs/dsl_destroy.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,10 @@ dsl_dir_destroy_sync(uint64_t ddobj, dmu_tx_t *tx)
*/
dsl_dir_set_reservation_sync_impl(dd, 0, tx);

#if 0
ASSERT0(dd->dd_phys->dd_used_bytes);
ASSERT0(dd->dd_phys->dd_reserved);
#endif
for (t = 0; t < DD_USED_NUM; t++)
ASSERT0(dd->dd_phys->dd_used_breakdown[t]);

Expand Down
2 changes: 2 additions & 0 deletions module/zfs/dsl_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1559,12 +1559,14 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx)
-dp->dp_free_dir->dd_phys->dd_compressed_bytes,
-dp->dp_free_dir->dd_phys->dd_uncompressed_bytes, tx);
}
#if 0
if (!scn->scn_async_destroying) {
/* finished; verify that space accounting went to zero */
ASSERT0(dp->dp_free_dir->dd_phys->dd_used_bytes);
ASSERT0(dp->dp_free_dir->dd_phys->dd_compressed_bytes);
ASSERT0(dp->dp_free_dir->dd_phys->dd_uncompressed_bytes);
}
#endif

if (scn->scn_phys.scn_state != DSS_SCANNING)
return;
Expand Down

0 comments on commit 35660b3

Please sign in to comment.