416 /*
417 * Called at spa_load time to release a stale temporary user hold.
418 * Also called by the onexit code.
419 */
420 void
421 dsl_dataset_user_release_tmp(dsl_pool_t *dp, uint64_t dsobj, const char *htag)
422 {
423 dsl_dataset_user_release_tmp_arg_t ddurta;
424 dsl_dataset_t *ds;
425 int error;
426
427 #ifdef _KERNEL
428 /* Make sure it is not mounted. */
429 dsl_pool_config_enter(dp, FTAG);
430 error = dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds);
431 if (error == 0) {
432 char name[MAXNAMELEN];
433 dsl_dataset_name(ds, name);
434 dsl_dataset_rele(ds, FTAG);
435 dsl_pool_config_exit(dp, FTAG);
436 zfs_unmount_snap(name);
437 } else {
438 dsl_pool_config_exit(dp, FTAG);
439 }
440 #endif
441
442 ddurta.ddurta_dsobj = dsobj;
443 ddurta.ddurta_holds = fnvlist_alloc();
444 fnvlist_add_boolean(ddurta.ddurta_holds, htag);
445
446 (void) dsl_sync_task(spa_name(dp->dp_spa),
447 dsl_dataset_user_release_tmp_check,
448 dsl_dataset_user_release_tmp_sync, &ddurta, 1);
449 fnvlist_free(ddurta.ddurta_holds);
450 }
451
452 typedef struct zfs_hold_cleanup_arg {
453 char zhca_spaname[MAXNAMELEN];
454 uint64_t zhca_spa_load_guid;
455 uint64_t zhca_dsobj;
456 char zhca_htag[MAXNAMELEN];
|
416 /*
417 * Called at spa_load time to release a stale temporary user hold.
418 * Also called by the onexit code.
419 */
420 void
421 dsl_dataset_user_release_tmp(dsl_pool_t *dp, uint64_t dsobj, const char *htag)
422 {
423 dsl_dataset_user_release_tmp_arg_t ddurta;
424 dsl_dataset_t *ds;
425 int error;
426
427 #ifdef _KERNEL
428 /* Make sure it is not mounted. */
429 dsl_pool_config_enter(dp, FTAG);
430 error = dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds);
431 if (error == 0) {
432 char name[MAXNAMELEN];
433 dsl_dataset_name(ds, name);
434 dsl_dataset_rele(ds, FTAG);
435 dsl_pool_config_exit(dp, FTAG);
436 (void) zfs_unmount_snap(name);
437 } else {
438 dsl_pool_config_exit(dp, FTAG);
439 }
440 #endif
441
442 ddurta.ddurta_dsobj = dsobj;
443 ddurta.ddurta_holds = fnvlist_alloc();
444 fnvlist_add_boolean(ddurta.ddurta_holds, htag);
445
446 (void) dsl_sync_task(spa_name(dp->dp_spa),
447 dsl_dataset_user_release_tmp_check,
448 dsl_dataset_user_release_tmp_sync, &ddurta, 1);
449 fnvlist_free(ddurta.ddurta_holds);
450 }
451
452 typedef struct zfs_hold_cleanup_arg {
453 char zhca_spaname[MAXNAMELEN];
454 uint64_t zhca_spa_load_guid;
455 uint64_t zhca_dsobj;
456 char zhca_htag[MAXNAMELEN];
|