301 }
302 }
303
304 if (zcmd_read_dst_nvlist(hdl, &zc, &config) != 0) {
305 zcmd_free_nvlists(&zc);
306 return (-1);
307 }
308
309 zcmd_free_nvlists(&zc);
310
311 zhp->zpool_config_size = zc.zc_nvlist_dst_size;
312
313 if (zhp->zpool_config != NULL) {
314 uint64_t oldtxg, newtxg;
315
316 verify(nvlist_lookup_uint64(zhp->zpool_config,
317 ZPOOL_CONFIG_POOL_TXG, &oldtxg) == 0);
318 verify(nvlist_lookup_uint64(config,
319 ZPOOL_CONFIG_POOL_TXG, &newtxg) == 0);
320
321 if (zhp->zpool_old_config != NULL)
322 nvlist_free(zhp->zpool_old_config);
323
324 if (oldtxg != newtxg) {
325 nvlist_free(zhp->zpool_config);
326 zhp->zpool_old_config = NULL;
327 } else {
328 zhp->zpool_old_config = zhp->zpool_config;
329 }
330 }
331
332 zhp->zpool_config = config;
333 if (error)
334 zhp->zpool_state = POOL_STATE_UNAVAIL;
335 else
336 zhp->zpool_state = POOL_STATE_ACTIVE;
337
338 return (0);
339 }
340
341 /*
|
301 }
302 }
303
304 if (zcmd_read_dst_nvlist(hdl, &zc, &config) != 0) {
305 zcmd_free_nvlists(&zc);
306 return (-1);
307 }
308
309 zcmd_free_nvlists(&zc);
310
311 zhp->zpool_config_size = zc.zc_nvlist_dst_size;
312
313 if (zhp->zpool_config != NULL) {
314 uint64_t oldtxg, newtxg;
315
316 verify(nvlist_lookup_uint64(zhp->zpool_config,
317 ZPOOL_CONFIG_POOL_TXG, &oldtxg) == 0);
318 verify(nvlist_lookup_uint64(config,
319 ZPOOL_CONFIG_POOL_TXG, &newtxg) == 0);
320
321 nvlist_free(zhp->zpool_old_config);
322
323 if (oldtxg != newtxg) {
324 nvlist_free(zhp->zpool_config);
325 zhp->zpool_old_config = NULL;
326 } else {
327 zhp->zpool_old_config = zhp->zpool_config;
328 }
329 }
330
331 zhp->zpool_config = config;
332 if (error)
333 zhp->zpool_state = POOL_STATE_UNAVAIL;
334 else
335 zhp->zpool_state = POOL_STATE_ACTIVE;
336
337 return (0);
338 }
339
340 /*
|