Print this page
4012 Upper limit of zfs set bounds check for refreservation on volumes is too low

@@ -780,10 +780,12 @@
                 uint64_t spa_version;
                 char *p;
                 zfs_prop_t resv_prop;
                 char *strval;
                 char msg[1024];
+                uint64_t volblocksize;
+                int ncopies;
 
                 if (p = strchr(argv[0], '/'))
                         *p = '\0';
                 zpool_handle = zpool_open(g_zfs, argv[0]);
                 if (p != NULL)

@@ -802,11 +804,22 @@
                     gettext("cannot create '%s'"), argv[0]);
                 if (props && (real_props = zfs_valid_proplist(g_zfs, type,
                     props, 0, NULL, msg)) == NULL)
                         goto error;
 
-                volsize = zvol_volsize_to_reservation(volsize, real_props);
+                if (nvlist_lookup_string(real_props,
+                    zfs_prop_to_name(ZFS_PROP_COPIES), &strval) == 0)
+                        ncopies = atoi(strval);
+                else
+                        ncopies = 1;
+                if (nvlist_lookup_uint64(real_props,
+                    zfs_prop_to_name(ZFS_PROP_VOLBLOCKSIZE),
+                    &volblocksize) != 0)
+                        volblocksize = ZVOL_DEFAULT_BLOCKSIZE;
+
+                volsize = zvol_volsize_to_reservation(volsize,
+                    volblocksize, ncopies);
                 nvlist_free(real_props);
 
                 if (nvlist_lookup_string(props, zfs_prop_to_name(resv_prop),
                     &strval) != 0) {
                         if (nvlist_add_uint64(props,