--- a/sys/vfs/hammer2/hammer2_xops.c +++ b/sys/vfs/hammer2/hammer2_xops.c @@ -1579,7 +1579,15 @@ switch (chain->bref.type) { case HAMMER2_BREF_TYPE_DIRENT: case HAMMER2_BREF_TYPE_INODE: - KKASSERT(0); + /* + * Crafted or corrupted media can place a + * non-DATA chain under a regular-file inode. + * Fail the truncation instead of panicking + * (matches the CHECK error that + * hammer2_chain_inode_find fabricates on + * inconsistent media). + */ + error = HAMMER2_ERROR_CHECK; break; case HAMMER2_BREF_TYPE_DATA: hammer2_chain_delete(parent, chain,