Index: trunk/Nebulous-Server/lib/Nebulous/Server.pm
===================================================================
--- trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 24327)
+++ trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 24329)
@@ -1736,15 +1736,21 @@
     foreach my $inst (@$locations) {
         my $path = URI->new($inst)->path;
-        chmod $mode, $path
-            or $log->logdie("chmod() failed: $!");
+
+        _retry(sub { chmod($mode, $path) })
+            or $log->logdie("can not chmod() $path: $!");
+
         # XXX I'm assuming that it's OK to fsync() a filehandle that's only
         # open for reading?  Opening as w/rw here can fail if the chmod removes
         # write permissions.
-        my $fh = IO::File->new($path, "r")
-            or $log->logdie("open() of $path failed: $!");;
+        my $fh;
+        _retry(sub { open($fh, '<', $path) })
+            or $log->logdie("can not open() $path: $!");
+
         # fsync(3c)
-        $fh->sync;
-        close ($fh)
-            or $log->logdie("close() failed: $!");
+        _retry(sub { $fh->sync() })
+            or $log->logdie("can not sync() $path: $!");
+
+        _retry(sub { close($fh) })
+            or $log->logdie("can not close() $path: $!");
     }
 
@@ -1992,5 +1998,6 @@
         unless ($mode == 0775) {
             $log->error("$storage_path has the wrong permissions of: 0", sprintf("%o", $mode));
-            _retry(sub { chmod(0775, $storage_path) }) or die "can't chmod $storage_path: $!";
+            _retry(sub { chmod(0775, $storage_path) })
+                or $log->logdie("can not chmod() $storage_path: $!");
         }
 
@@ -2024,19 +2031,21 @@
 
     # perl's open() can't do an O_CREAT | O_EXCL
-    die "file $path already exists" if (-e $path);
+    # XXX is it possible to tell if this system call failed?
+    -e $path
+        and $log->logdie("file $path already exists");
 
     my $fh;
-    die "can not open $path: $!"
-        unless (_retry(sub { open($fh, '>', $path) }));
+    _retry(sub { open($fh, '>', $path) })
+        or $log->logdie("can not open() $path: $!");
 
     # chmod before fsync() to make sure the changed perms hit the disk too
-    die "can not chmod $path: $!"
-        unless (_retry(sub { chmod(0664, $path) }));
-
-    die "can not sync $path: $!"
-        unless (_retry(sub { $fh->sync() }));
-
-    die "can not close $path: $!"
-        unless (_retry(sub { close($fh) }));
+    _retry(sub { chmod(0664, $path) })
+        or $log->logdie("can not chmod() $path: $!");
+
+    _retry(sub { $fh->sync() })
+        or $log->logdie("can not sync() $path: $!");
+
+    _retry(sub { close($fh) })
+        or $log->logdie("can not close() $path: $!");
 
     return $path;
