comparison usr/src/lib/libzfs/common/libzfs_dataset.c @ 13967:92bec6d87f59

3557 dumpvp_size is not updated correctly when a dump zvol's size is changed 3558 setting the volsize on a dump device does not return back ENOSPC 3559 setting a volsize larger than the space available sometimes succeeds 3560 dumpadm should be able to remove a dump device Reviewed by: Adam Leventhal <ahl@delphix.com> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Christopher Siden <christopher.siden@delphix.com> Approved by: Albert Lee <trisk@nexenta.com>
author George Wilson <george.wilson@delphix.com>
date Wed, 20 Feb 2013 22:50:16 -0800
parents 4b38a0c01186
children 4972ab336f54
comparison
equal deleted inserted replaced
13966:0e1d84ebb004 13967:92bec6d87f59
1281 uint64_t old_volsize; 1281 uint64_t old_volsize;
1282 uint64_t new_volsize; 1282 uint64_t new_volsize;
1283 uint64_t old_reservation; 1283 uint64_t old_reservation;
1284 uint64_t new_reservation; 1284 uint64_t new_reservation;
1285 zfs_prop_t resv_prop; 1285 zfs_prop_t resv_prop;
1286 nvlist_t *props;
1286 1287
1287 /* 1288 /*
1288 * If this is an existing volume, and someone is setting the volsize, 1289 * If this is an existing volume, and someone is setting the volsize,
1289 * make sure that it matches the reservation, or add it if necessary. 1290 * make sure that it matches the reservation, or add it if necessary.
1290 */ 1291 */
1291 old_volsize = zfs_prop_get_int(zhp, ZFS_PROP_VOLSIZE); 1292 old_volsize = zfs_prop_get_int(zhp, ZFS_PROP_VOLSIZE);
1292 if (zfs_which_resv_prop(zhp, &resv_prop) < 0) 1293 if (zfs_which_resv_prop(zhp, &resv_prop) < 0)
1293 return (-1); 1294 return (-1);
1294 old_reservation = zfs_prop_get_int(zhp, resv_prop); 1295 old_reservation = zfs_prop_get_int(zhp, resv_prop);
1295 if ((zvol_volsize_to_reservation(old_volsize, zhp->zfs_props) != 1296
1296 old_reservation) || nvlist_lookup_uint64(nvl, 1297 props = fnvlist_alloc();
1297 zfs_prop_to_name(resv_prop), &new_reservation) != ENOENT) { 1298 fnvlist_add_uint64(props, zfs_prop_to_name(ZFS_PROP_VOLBLOCKSIZE),
1299 zfs_prop_get_int(zhp, ZFS_PROP_VOLBLOCKSIZE));
1300
1301 if ((zvol_volsize_to_reservation(old_volsize, props) !=
1302 old_reservation) || nvlist_exists(nvl,
1303 zfs_prop_to_name(resv_prop))) {
1304 fnvlist_free(props);
1298 return (0); 1305 return (0);
1299 } 1306 }
1300 if (nvlist_lookup_uint64(nvl, zfs_prop_to_name(ZFS_PROP_VOLSIZE), 1307 if (nvlist_lookup_uint64(nvl, zfs_prop_to_name(ZFS_PROP_VOLSIZE),
1301 &new_volsize) != 0) 1308 &new_volsize) != 0) {
1309 fnvlist_free(props);
1302 return (-1); 1310 return (-1);
1303 new_reservation = zvol_volsize_to_reservation(new_volsize, 1311 }
1304 zhp->zfs_props); 1312 new_reservation = zvol_volsize_to_reservation(new_volsize, props);
1313 fnvlist_free(props);
1314
1305 if (nvlist_add_uint64(nvl, zfs_prop_to_name(resv_prop), 1315 if (nvlist_add_uint64(nvl, zfs_prop_to_name(resv_prop),
1306 new_reservation) != 0) { 1316 new_reservation) != 0) {
1307 (void) no_memory(zhp->zfs_hdl); 1317 (void) no_memory(zhp->zfs_hdl);
1308 return (-1); 1318 return (-1);
1309 } 1319 }