Index: trunk/Nebulous-Server/bin/nebdiskd
===================================================================
--- trunk/Nebulous-Server/bin/nebdiskd	(revision 26294)
+++ trunk/Nebulous-Server/bin/nebdiskd	(revision 26380)
@@ -67,4 +67,10 @@
 $retry      ||= $c->get_retry   || 1;
 
+# stuff to controll failures.
+my %host_failure_counts = ();
+my $failure_limit = 5;
+
+
+
 #my $mounts = $c->get_mounts;
 my $poll_interval = $c->get_poll_interval || 5;
@@ -133,4 +139,5 @@
 $SIG{INT}  = $SIG{TERM};
 $SIG{HUP}  = sub { $c = read_rcfile($rcfile) }; 
+
 
 while (1) {
@@ -202,4 +209,7 @@
             my $tries = 0;
 	    my $valid_mountpoint = 1;
+	    unless (exists($host_failure_counts{$mountpoint})) {
+		$host_failure_counts{$mountpoint} = 0;
+	    }
             TEST: eval {
                 $tries++;
@@ -215,10 +225,19 @@
                     goto TEST; 
                 }
-		$log->warn("Removing $mountpoint from the mountedvol table ($tries > $retry)");
- #               $log->warn($@);
-
-                $d_query->execute($mountpoint);
+		$host_failure_counts{$mountpoint}++;
+
+		if ($host_failure_counts{$mountpoint} > $failure_limit) {
+		    $log->warn("Removing $mountpoint from the mountedvol table ($host_failure_counts{$mountpoint} > $failure_limit)");
+		    $d_query->execute($mountpoint);
+		}
+		else {
+		    $log->warn("Mountpoint $mountpoint has had $host_failure_counts{$mountpoint} failures. Will remove after $failure_limit");
+		}
                 next;
             }
+	    if ($host_failure_counts{$mountpoint} != 0) {
+		$log->warn("Mountpoint $mountpoint failures cleared ($host_failure_counts{$mountpoint})");
+		$host_failure_counts{$mountpoint} = 0;
+	    }
 
             # fetch stats on the mounted device.  this has to be done AFTER
