aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2023-09-27 15:56:33 +0000
committerMark Johnston <markj@FreeBSD.org>2023-10-04 13:42:14 +0000
commitea5173e5725564da4b95a5b98410b8cd43520dab (patch)
tree8cabf872547ed64f01d14411a2ab5aba6a45344c
parentd4a5d7a15544d5e561f4235b9b40457e2c52626a (diff)
downloadsrc-ea5173e5725564da4b95a5b98410b8cd43520dab.tar.gz
src-ea5173e5725564da4b95a5b98410b8cd43520dab.zip
makefs/zfs: Set the objset block pointer fill field correctly
It is supposed to contain the number of objects allocated from the set, excluding the meta dnode. Reported by: mav MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit 46402fd21631b7d4686f8c341d92db6bcb190e5d)
-rw-r--r--usr.sbin/makefs/zfs/objset.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/makefs/zfs/objset.c b/usr.sbin/makefs/zfs/objset.c
index 22277c150712..3e3dcdeced4b 100644
--- a/usr.sbin/makefs/zfs/objset.c
+++ b/usr.sbin/makefs/zfs/objset.c
@@ -121,6 +121,7 @@ _objset_write(zfs_opt_t *zfs, zfs_objset_t *os, struct dnode_cursor *c,
STAILQ_FOREACH_SAFE(chunk, &os->dnodechunks, next, tmp) {
unsigned int i;
+ assert(chunk->nextfree > 0);
assert(chunk->nextfree <= os->dnodecount);
assert(chunk->nextfree <= DNODES_PER_CHUNK);
@@ -149,8 +150,8 @@ _objset_write(zfs_opt_t *zfs, zfs_objset_t *os, struct dnode_cursor *c,
* Write the object set itself. The saved block pointer will be copied
* into the referencing DSL dataset or the uberblocks.
*/
- vdev_pwrite_data(zfs, DMU_OT_OBJSET, ZIO_CHECKSUM_FLETCHER_4, 0, 1,
- os->phys, os->osblksz, os->osloc, &os->osbp);
+ vdev_pwrite_data(zfs, DMU_OT_OBJSET, ZIO_CHECKSUM_FLETCHER_4, 0,
+ os->dnodecount - 1, os->phys, os->osblksz, os->osloc, &os->osbp);
}
void