summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorMike Gerdts <[email protected]>2019-06-30 23:38:07 +0000
committerTony Hutter <[email protected]>2020-01-22 13:48:56 -0800
commitf3f46b0e45e64d169f0faa08a01fcafafd8d179a (patch)
tree533f9e7ebd8d36540a01d8b584ffa7b90af22ddb /cmd
parent350646563fe7203cbc185acd25c12e16ea43f613 (diff)
OpenZFS 9318 - vol_volsize_to_reservation does not account for raidz skip blocks
When a volume is created in a pool with raidz vdevs and volblocksize != 128k, the volume can reference more space than is reserved with the automatically calculated refreservation. There are two deficiencies in vol_volsize_to_reservation that contribute to this: 1) Skip blocks may be added to keep each allocation a multiple of parity + 1. This is the dominating factor when volblocksize is close to 2^ashift. 2) raidz deflation for 128 KB blocks is different for most other block sizes. See "The theory of raidz space accounting" comment in libzfs_dataset.c for a full explanation. Authored by: Mike Gerdts <[email protected]> Reviewed by: Richard Elling <[email protected]> Reviewed by: Sanjay Nadkarni <[email protected]> Reviewed by: Jerry Jelinek <[email protected]> Reviewed by: Matt Ahrens <[email protected]> Reviewed by: Kody Kantor <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Approved by: Dan McDonald <[email protected]> Ported-by: Mike Gerdts <[email protected]> Porting Notes: * ZTS: wait for zvols to exist before writing * ZTS: use log_must_busy with {zpool|zfs} destroy OpenZFS-issue: https://www.illumos.org/issues/9318 OpenZFS-commit: https://github.com/illumos/illumos-gate/commit/b73ccab0 Closes #8973
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zfs/zfs_main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index 074216055..224a004d8 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -29,6 +29,7 @@
* Copyright 2016 Nexenta Systems, Inc.
* Copyright (c) 2019 Datto Inc.
* Copyright (c) 2019, loli10K <[email protected]>
+ * Copyright 2019 Joyent, Inc.
*/
#include <assert.h>
@@ -992,10 +993,11 @@ zfs_do_create(int argc, char **argv)
zpool_close(zpool_handle);
goto error;
}
- zpool_close(zpool_handle);
- volsize = zvol_volsize_to_reservation(volsize, real_props);
+ volsize = zvol_volsize_to_reservation(zpool_handle, volsize,
+ real_props);
nvlist_free(real_props);
+ zpool_close(zpool_handle);
if (nvlist_lookup_string(props, zfs_prop_to_name(resv_prop),
&strval) != 0) {