git: 9front

Download patch

ref: 48124144e1a209082347ec9e82b371bcb30e6d4a
parent: 388f650e128063d891c086eea389b5db0c733339
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Nov 27 17:37:32 EST 2018

fshalt: wait for fileservers command file to vanish

cwfs and hjfs create ther /srv command files with
ORCLOSE flag, so they get removed once the fileserver
terminates. we can use this to check that the fileserver
has in fact finished halting without making assumtions
about the time it should maximally take for any fileserver
to write out its buffers to disk.

--- a/rc/bin/fshalt
+++ b/rc/bin/fshalt
@@ -45,6 +45,7 @@
 cp /bin/sed /tmp
 cp /bin/sleep /tmp
 cp /bin/scram /tmp
+cp /bin/test /tmp
 bind /tmp /rc
 bind /tmp /bin
 
@@ -53,15 +54,12 @@
 fn x {
 	echo
 	echo -n halting...
-	for (i in $c){
-		echo -n $i...
+	for (i in $c $h)
 		echo halt >>$i
-		sleep 2
-	}
-	for(i in $h){
-		echo -n $i
-		echo halt >>$i
-		sleep 2
+	for (i in $c $h){
+		echo -n $i...
+		while(test -e $i)
+			sleep 1
 	}
 	echo
 	echo done halting
--