diff options
author | mm <mm@FreeBSD.org> | 2010-05-11 09:19:41 +0000 |
---|---|---|
committer | mm <mm@FreeBSD.org> | 2010-05-11 09:19:41 +0000 |
commit | e1cc9b41b9e8f3f563009f99c0475b351678bfc1 (patch) | |
tree | c8adcb88b0bf8e77cd5b0d3b74c7c0521309dfac /sys/cddl | |
parent | 29ba4cd6b8ea727021429b5534a950a23b28771b (diff) | |
download | FreeBSD-src-e1cc9b41b9e8f3f563009f99c0475b351678bfc1.zip FreeBSD-src-e1cc9b41b9e8f3f563009f99c0475b351678bfc1.tar.gz |
Fix zfs rename (may occasionally fail with dataset busy).
OpenSolaris onnv revision: 8517:41a0783dde17
PR: kern/146471
Approved by: pjd, delphij (mentor)
Obtained from: OpenSolaris (Bug ID 6784757)
MFC after: 3 days
Diffstat (limited to 'sys/cddl')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c index a27150b..bf4ec12 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -2205,6 +2205,12 @@ dsl_dataset_rename(char *oldname, const char *newname, boolean_t recursive) err = dsl_dir_open(oldname, FTAG, &dd, &tail); if (err) return (err); + /* + * If there are more than 2 references there may be holds + * hanging around that haven't been cleared out yet. + */ + if (dmu_buf_refcount(dd->dd_dbuf) > 2) + txg_wait_synced(dd->dd_pool, 0); if (tail == NULL) { int delta = strlen(newname) - strlen(oldname); |