Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Oct 2013 07:51:09 +0000 (UTC)
From:      Peter Holm <pho@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r257374 - user/pho/stress2/misc
Message-ID:  <201310300751.r9U7p9dU070723@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pho
Date: Wed Oct 30 07:51:08 2013
New Revision: 257374
URL: http://svnweb.freebsd.org/changeset/base/257374

Log:
  Do not loop forever trying to unmount a busy file system.
  Detach from the controlling terminal to ignore SIGSTOP.
  
  Sponsored by:	EMC / Isilon storage division

Modified:
  user/pho/stress2/misc/syscall4.sh

Modified: user/pho/stress2/misc/syscall4.sh
==============================================================================
--- user/pho/stress2/misc/syscall4.sh	Wed Oct 30 06:18:54 2013	(r257373)
+++ user/pho/stress2/misc/syscall4.sh	Wed Oct 30 07:51:08 2013	(r257374)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2011 Peter Holm
+# Copyright (c) 2011-2013 Peter Holm
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -59,17 +59,24 @@ chmod 777 $mntpoint
 
 sleeptime=${sleeptime:-12}
 for i in `jot 10`; do
-echo "Loop #$i"
 	(cd $mntpoint; /tmp/syscall4 $* < /dev/null) &
-	[ $# -eq 1 ] && sleep $sleeptime || sleep 180
-	killall -9 syscall4
+	[ $# -eq 1 ] && sleep $sleeptime || sleep 120
+	killall -9 syscall4 > /dev/null 2>&1
+	wait
 	ipcs | awk '/^(q|m|s)/ {print " -" $1, $2}' | xargs -L 1 ipcrm
 done
 
-while mount | grep $mntpoint | grep -q /dev/md; do
-	umount $mntpoint || sleep 1
+
+for i in `jot 10`; do
+	mount | grep -q md${mdstart}$part  && \
+		umount $mntpoint && mdconfig -d -u $mdstart && break
+	sleep 10
 done
-mdconfig -d -u $mdstart
+if mount | grep -q md${mdstart}$part; then
+	fstat $mntpoint
+	echo "umount $mntpoint failed"
+	exit 1
+fi
 rm -f /tmp/syscall4
 exit
 EOF
@@ -276,6 +283,9 @@ main(int argc, char **argv)
 				errx(0, "syscall #%d is on the ignore list.", syscallno);
 	}
 
+	if (daemon(0, 0) == -1)
+		err(1, "daemon()");
+
 	start = time(NULL);
 	while ((time(NULL) - start) < 120) {
 		if (fork() == 0) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310300751.r9U7p9dU070723>