Mercurial > illumos > illumos-gate
changeset 3637:526d8412c163
6402600 administrative actions while doing 'zfs recv' or 'zfs destroy' can cause confusing situation
author | rm160521 |
---|---|
date | Mon, 12 Feb 2007 15:22:44 -0800 |
parents | 1f5a3ccc94df |
children | 6b28ebc717aa |
files | usr/src/uts/common/fs/zfs/dmu_objset.c |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/dmu_objset.c Mon Feb 12 14:23:36 2007 -0800 +++ b/usr/src/uts/common/fs/zfs/dmu_objset.c Mon Feb 12 15:22:44 2007 -0800 @@ -585,6 +585,7 @@ { struct snaparg *sn = arg; objset_t *os; + dmu_objset_stats_t stat; int err; (void) strcpy(sn->failed, name); @@ -594,6 +595,15 @@ return (err); /* + * If the objset is in an inconsistent state, return busy. + */ + dmu_objset_fast_stat(os, &stat); + if (stat.dds_inconsistent) { + dmu_objset_close(os); + return (EBUSY); + } + + /* * NB: we need to wait for all in-flight changes to get to disk, * so that we snapshot those changes. zil_suspend does this as * a side effect. @@ -602,7 +612,10 @@ if (err == 0) { dsl_sync_task_create(sn->dstg, dsl_dataset_snapshot_check, dsl_dataset_snapshot_sync, os, sn->snapname, 3); + } else { + dmu_objset_close(os); } + return (err); }