viced-copyonwrite-give-useful-error-messages-when-taking-volumes-offline-20010720
[openafs.git] / src / viced / afsfileprocs.c
index d92e55b..5a1cef1 100644 (file)
  * privilege"? 
  */
 
+#include <afsconfig.h>
 #include <afs/param.h>
+
+RCSID("$Header$");
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
@@ -74,7 +78,7 @@
 #include <rx/rx.h>
 #include <rx/rx_globals.h>
 #include <sys/stat.h>
-#if ! defined(AFS_SGI_ENV) && ! defined(AFS_AIX32_ENV) && ! defined(AFS_NT40_ENV) && ! defined(AFS_LINUX20_ENV)
+#if ! defined(AFS_SGI_ENV) && ! defined(AFS_AIX32_ENV) && ! defined(AFS_NT40_ENV) && ! defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
 #include <sys/map.h>
 #endif
 #if !defined(AFS_NT40_ENV)
@@ -85,7 +89,7 @@
 #include <sys/statfs.h>
 #include <sys/lockf.h>
 #else
-#if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
 #include <sys/dk.h>
 #endif
 #endif
@@ -314,7 +318,18 @@ retry:
     else if (thost->hostFlags & VENUSDOWN) {
       if (BreakDelayedCallBacks_r(thost)) {
        ViceLog(0,("BreakDelayedCallbacks FAILED for host %08x which IS UP.  Possible network or routing failure.\n",thost->host));
-       code = -1;
+       if ( MultiProbeAlternateAddress_r (thost) ) {
+           ViceLog(0, ("MultiProbe failed to find new address for host %x.%d\n",
+                       thost->host, thost->port));
+           code = -1;
+       } else {
+           ViceLog(0, ("MultiProbe found new address for host %x.%d\n",
+                       thost->host, thost->port));
+           if (BreakDelayedCallBacks_r(thost)) {
+               ViceLog(0,("BreakDelayedCallbacks FAILED AGAIN for host %08x which IS UP.  Possible network or routing failure.\n",thost->host));
+               code = -1;
+           }
+       }
       }
     } else {
        code =  0;
@@ -6388,17 +6403,19 @@ int CopyOnWrite(targetptr, volptr)
                        rc = IH_DEC(V_linkHandle(volptr), ino,
                                  V_parentId(volptr));
                        if (!rc ) {
-                           ViceLog(0,("CopyOnWrite failed: volume %u in partition %s needs salvage\n",
-                                   V_id(volptr), volptr->partition->name));
+                           ViceLog(0,("CopyOnWrite failed: error %u after i_dec on disk full, volume %u in partition %s needs salvage\n",
+                                      rc, V_id(volptr), 
+                                      volptr->partition->name));
                            VTakeOffline (volptr);
                        }
                        free(buff);
                        return ENOSPC;
                }
                else {
-                   ViceLog(0,("CopyOnWrite failed: volume %u in partition %s needs salvage\n",
-                           V_id(volptr), volptr->partition->name));
-                   /* Decrement this inode so salvager doesn't find it. */
+                   ViceLog(0,("CopyOnWrite failed: volume %u in partition %s  (tried reading %u, read %u, wrote %u, errno %u) volume needs salvage\n",
+                              V_id(volptr), volptr->partition->name, length,
+                              rdlen, wrlen, errno));
+                    /* Decrement this inode so salvager doesn't find it. */
                    FDH_REALLYCLOSE(newFdP);
                    IH_RELEASE(newH);
                    FDH_REALLYCLOSE(targFdP);