changeset 10944:30bda6952fd0

6894901 zoneadmd can hang if fdetach() return EBUSY
author Edward Pilatowicz <Edward.Pilatowicz@Sun.COM>
date Tue, 03 Nov 2009 19:20:02 -0800
parents b45d62b629cd
children b3afbf06f20d
files usr/src/cmd/zoneadmd/zoneadmd.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/zoneadmd/zoneadmd.c	Tue Nov 03 19:20:02 2009 -0800
+++ b/usr/src/cmd/zoneadmd/zoneadmd.c	Tue Nov 03 19:20:02 2009 -0800
@@ -2057,10 +2057,16 @@
 	 * fdetach(), the door will go unreferenced; once any
 	 * outstanding requests (like the door thread doing Z_HALT) are
 	 * done, the door will get an UNREF notification; when it handles
-	 * the UNREF, the door server will cause the exit.
+	 * the UNREF, the door server will cause the exit.  It's possible
+	 * that fdetach() can fail because the file is in use, in which
+	 * case we'll retry the operation.
 	 */
 	assert(!MUTEX_HELD(&lock));
-	(void) fdetach(zone_door_path);
+	for (;;) {
+		if ((fdetach(zone_door_path) == 0) || (errno != EBUSY))
+			break;
+		yield();
+	}
 
 	for (;;)
 		(void) pause();