dsl_prop.c (275782) | dsl_prop.c (286541) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 428 unchanged lines hidden (view full) --- 437 dsl_dir_t *dd = ds->ds_dir; 438 dsl_prop_cb_record_t *cbr; 439 440 mutex_enter(&dd->dd_lock); 441 for (cbr = list_head(&dd->dd_prop_cbs); cbr; 442 cbr = list_next(&dd->dd_prop_cbs, cbr)) { 443 uint64_t value; 444 | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 428 unchanged lines hidden (view full) --- 437 dsl_dir_t *dd = ds->ds_dir; 438 dsl_prop_cb_record_t *cbr; 439 440 mutex_enter(&dd->dd_lock); 441 for (cbr = list_head(&dd->dd_prop_cbs); cbr; 442 cbr = list_next(&dd->dd_prop_cbs, cbr)) { 443 uint64_t value; 444 |
445 /* 446 * Callback entries do not have holds on their datasets 447 * so that datasets with registered callbacks are still 448 * eligible for eviction. Unlike operations on callbacks 449 * for a single dataset, we are performing a recursive 450 * descent of related datasets and the calling context 451 * for this iteration only has a dataset hold on the root. 452 * Without a hold, the callback's pointer to the dataset 453 * could be invalidated by eviction at any time. 454 * 455 * Use dsl_dataset_try_add_ref() to verify that the 456 * dataset has not begun eviction processing and to 457 * prevent eviction from occurring for the duration 458 * of the callback. If the hold attempt fails, this 459 * object is already being evicted and the callback can 460 * be safely ignored. 461 */ 462 if (!dsl_dataset_try_add_ref(dp, cbr->cbr_ds, FTAG)) 463 continue; 464 |
|
445 if (dsl_prop_get_ds(cbr->cbr_ds, cbr->cbr_propname, 446 sizeof (value), 1, &value, NULL) == 0) 447 cbr->cbr_func(cbr->cbr_arg, value); | 465 if (dsl_prop_get_ds(cbr->cbr_ds, cbr->cbr_propname, 466 sizeof (value), 1, &value, NULL) == 0) 467 cbr->cbr_func(cbr->cbr_arg, value); |
468 469 dsl_dataset_rele(cbr->cbr_ds, FTAG); |
|
448 } 449 mutex_exit(&dd->dd_lock); 450 451 return (0); 452} 453 454/* 455 * Update all property values for ddobj & its descendants. This is used --- 36 unchanged lines hidden (view full) --- 492 return; 493 } 494 ASSERT3U(err, ==, ENOENT); 495 } 496 497 mutex_enter(&dd->dd_lock); 498 for (cbr = list_head(&dd->dd_prop_cbs); cbr; 499 cbr = list_next(&dd->dd_prop_cbs, cbr)) { | 470 } 471 mutex_exit(&dd->dd_lock); 472 473 return (0); 474} 475 476/* 477 * Update all property values for ddobj & its descendants. This is used --- 36 unchanged lines hidden (view full) --- 514 return; 515 } 516 ASSERT3U(err, ==, ENOENT); 517 } 518 519 mutex_enter(&dd->dd_lock); 520 for (cbr = list_head(&dd->dd_prop_cbs); cbr; 521 cbr = list_next(&dd->dd_prop_cbs, cbr)) { |
500 uint64_t propobj = dsl_dataset_phys(cbr->cbr_ds)->ds_props_obj; | 522 uint64_t propobj; |
501 | 523 |
502 if (strcmp(cbr->cbr_propname, propname) != 0) | 524 /* 525 * cbr->cbf_ds may be invalidated due to eviction, 526 * requiring the use of dsl_dataset_try_add_ref(). 527 * See comment block in dsl_prop_notify_all_cb() 528 * for details. 529 */ 530 if (strcmp(cbr->cbr_propname, propname) != 0 || 531 !dsl_dataset_try_add_ref(dp, cbr->cbr_ds, FTAG)) |
503 continue; 504 | 532 continue; 533 |
534 propobj = dsl_dataset_phys(cbr->cbr_ds)->ds_props_obj; 535 |
|
505 /* | 536 /* |
506 * If the property is set on this ds, then it is not 507 * inherited here; don't call the callback. | 537 * If the property is not set on this ds, then it is 538 * inherited here; call the callback. |
508 */ | 539 */ |
509 if (propobj && 0 == zap_contains(mos, propobj, propname)) 510 continue; | 540 if (propobj == 0 || zap_contains(mos, propobj, propname) != 0) 541 cbr->cbr_func(cbr->cbr_arg, value); |
511 | 542 |
512 cbr->cbr_func(cbr->cbr_arg, value); | 543 dsl_dataset_rele(cbr->cbr_ds, FTAG); |
513 } 514 mutex_exit(&dd->dd_lock); 515 516 za = kmem_alloc(sizeof (zap_attribute_t), KM_SLEEP); 517 for (zap_cursor_init(&zc, mos, 518 dsl_dir_phys(dd)->dd_child_dir_zapobj); 519 zap_cursor_retrieve(&zc, za) == 0; 520 zap_cursor_advance(&zc)) { --- 606 unchanged lines hidden --- | 544 } 545 mutex_exit(&dd->dd_lock); 546 547 za = kmem_alloc(sizeof (zap_attribute_t), KM_SLEEP); 548 for (zap_cursor_init(&zc, mos, 549 dsl_dir_phys(dd)->dd_child_dir_zapobj); 550 zap_cursor_retrieve(&zc, za) == 0; 551 zap_cursor_advance(&zc)) { --- 606 unchanged lines hidden --- |