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
This commit is contained in:
mm 2010-05-11 09:19:41 +00:00
parent 29ba4cd6b8
commit e1cc9b41b9

View File

@ -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);