Author: mm
Date: Tue May 11 09:19:41 2010
New Revision: 207909
URL: http://svn.freebsd.org/changeset/base/207909

Log:
  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

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c   Tue May 
11 07:25:13 2010        (r207908)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c   Tue May 
11 09:19:41 2010        (r207909)
@@ -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 
        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);
 
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to