libafs: kill rxevent daemon even in upcall mode
[openafs.git] / src / afs / afs_call.c
index 0ed56ef..63b5b0c 100644 (file)
@@ -58,7 +58,6 @@ krwlock_t afsifinfo_lock;
 
 afs_int32 afs_initState = 0;
 afs_int32 afs_termState = 0;
-afs_int32 afs_setTime = 0;
 int afs_cold_shutdown = 0;
 char afs_SynchronousCloses = '\0';
 static int afs_CB_Running = 0;
@@ -75,6 +74,7 @@ char afs_cachebasedir[1024];
 afs_int32 afs_rx_deadtime = AFS_RXDEADTIME;
 afs_int32 afs_rx_harddead = AFS_HARDDEADTIME;
 afs_int32 afs_rx_idledead = AFS_IDLEDEADTIME;
+afs_int32 afs_rx_idledead_rep = AFS_IDLEDEADTIME_REP;
 
 static int afscall_set_rxpck_received = 0;
 
@@ -114,7 +114,7 @@ afs_InitSetup(int preallocs)
 
     memset(afs_zeros, 0, AFS_ZEROS);
 
-    rx_SetBusyChannelError(RX_CALL_TIMEOUT);
+    rx_SetBusyChannelError(1);  /* turn on busy call error reporting */
 
     /* start RX */
     if(!afscall_set_rxpck_received)
@@ -606,7 +606,7 @@ afs_syscall_call(long parm, long parm2, long parm3,
 #endif
 {
     afs_int32 code = 0;
-#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+#if defined(AFS_SGI61_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
     size_t bufferSize;
 #else /* AFS_SGI61_ENV */
     u_int bufferSize;
@@ -981,7 +981,10 @@ afs_syscall_call(long parm, long parm2, long parm3,
        }
        afs_CacheInit_Done = 1;
         code = afs_icl_InitLogs();
-       afs_setTime = cparms.setTimeFlag;
+       if (cparms.setTimeFlag) {
+           afs_warn("afs: AFSOP_CACHEINIT setTimeFlag ignored; are you "
+                    "running an old afsd?\n");
+       }
 
        code =
            afs_CacheInit(cparms.cacheScaches, cparms.cacheFiles,
@@ -1064,7 +1067,11 @@ afs_syscall_call(long parm, long parm2, long parm3,
        while (afs_initState < AFSOP_GO)
            afs_osi_Sleep(&afs_initState);
        afs_initState = 101;
-       afs_setTime = parm2;
+       if (parm2) {
+           /* parm2 used to set afs_setTime */
+           afs_warn("afs: AFSOP_GO setTime flag ignored; are you running an "
+                    "old afsd?\n");
+       }
        if (afs_tpct1 + afs_tpct2 != 100) {
            afs_tpct1 = 0;
            afs_tpct2 = 0;
@@ -1076,7 +1083,9 @@ afs_syscall_call(long parm, long parm2, long parm3,
 #if    (!defined(AFS_NONFSTRANS)) || defined(AFS_AIX_IAUTH_ENV)
        afs_nfsclient_init();
 #endif
-       afs_uuid_create(&afs_cb_interface.uuid);
+       if (afs_uuid_create(&afs_cb_interface.uuid) != 0)
+           memset(&afs_cb_interface.uuid, 0, sizeof(afsUUID));
+
        printf("found %d non-empty cache files (%d%%).\n",
               afs_stats_cmperf.cacheFilesReused,
               (100 * afs_stats_cmperf.cacheFilesReused) /
@@ -1164,35 +1173,9 @@ afs_syscall_call(long parm, long parm2, long parm3,
 
        if (refresh) {
            afs_CheckServers(1, NULL);     /* check down servers */
-           afs_CheckServers(0, NULL);     /* check down servers */
+           afs_CheckServers(0, NULL);     /* check up servers */
        }
     }
-#ifdef AFS_SGI53_ENV
-    else if (parm == AFSOP_NFSSTATICADDR) {
-       extern int (*nfs_rfsdisptab_v2) ();
-       nfs_rfsdisptab_v2 = (int (*)())parm2;
-    } else if (parm == AFSOP_NFSSTATICADDR2) {
-       extern int (*nfs_rfsdisptab_v2) ();
-# ifdef _K64U64
-       nfs_rfsdisptab_v2 = (int (*)())((parm2 << 32) | (parm3 & 0xffffffff));
-# else /* _K64U64 */
-       nfs_rfsdisptab_v2 = (int (*)())(parm3 & 0xffffffff);
-# endif /* _K64U64 */
-    }
-# if defined(AFS_SGI62_ENV) && !defined(AFS_SGI65_ENV)
-    else if (parm == AFSOP_SBLOCKSTATICADDR2) {
-       extern int (*afs_sblockp) ();
-       extern void (*afs_sbunlockp) ();
-#  ifdef _K64U64
-       afs_sblockp = (int (*)())((parm2 << 32) | (parm3 & 0xffffffff));
-       afs_sbunlockp = (void (*)())((parm4 << 32) | (parm5 & 0xffffffff));
-#  else
-       afs_sblockp = (int (*)())(parm3 & 0xffffffff);
-       afs_sbunlockp = (void (*)())(parm5 & 0xffffffff);
-#  endif /* _K64U64 */
-    }
-# endif /* AFS_SGI62_ENV && !AFS_SGI65_ENV */
-#endif /* AFS_SGI53_ENV */
     else if (parm == AFSOP_SHUTDOWN) {
        afs_cold_shutdown = 0;
        if (parm2 == 1)
@@ -1310,6 +1293,8 @@ afs_syscall_call(long parm, long parm2, long parm3,
        afscall_set_rxpck_received = 1;
     } else if (parm == AFSOP_SET_RXMAXMTU) {
        rx_MyMaxSendSize = rx_maxReceiveSizeUser = rx_maxReceiveSize = parm2;
+    } else if (parm == AFSOP_SET_RXMAXFRAGS) {
+       rxi_nSendFrags = rxi_nRecvFrags = parm2;
     } else {
        code = EINVAL;
     }
@@ -1367,12 +1352,27 @@ afs_shutdown(void)
     if (afs_shuttingdown)
        return;
 
+    /* Give up all of our callbacks if we can. This must be done before setting
+     * afs_shuttingdown, since it calls afs_InitReq, which will fail if
+     * afs_shuttingdown is set. */
+    afs_FlushVCBs(2);
+
     afs_shuttingdown = 1;
+
     if (afs_cold_shutdown)
        afs_warn("afs: COLD ");
     else
        afs_warn("afs: WARM ");
-    afs_warn("shutting down of: CB... ");
+    afs_warn("shutting down of: vcaches... ");
+
+#if !defined(AFS_FBSD_ENV)
+    /* The FBSD afs_unmount() calls vflush(), which reclaims all vnodes
+     * on the mountpoint, flushing them in the process.  In the presence
+     * of bugs, flushing again here can cause panics. */
+    afs_FlushAllVCaches();
+#endif
+
+    afs_warn("CB... ");
 
     afs_termState = AFSOP_STOP_RXCALLBACK;
     rx_WakeupServerProcs();
@@ -1410,7 +1410,7 @@ afs_shutdown(void)
     afs_StopAFSDB();
     while (afs_termState == AFSOP_STOP_AFSDB)
        afs_osi_Sleep(&afs_termState);
-#if    defined(AFS_SUN5_ENV) || defined(RXK_LISTENER_ENV)
+#if    defined(AFS_SUN5_ENV) || defined(RXK_LISTENER_ENV) || defined(RXK_UPCALL_ENV)
     afs_warn("RxEvent... ");
     /* cancel rx event daemon */
     while (afs_termState == AFSOP_STOP_RXEVENT)
@@ -1485,7 +1485,7 @@ void
 shutdown_afstest(void)
 {
     AFS_STATCNT(shutdown_afstest);
-    afs_initState = afs_termState = afs_setTime = 0;
+    afs_initState = afs_termState = 0;
     AFS_Running = afs_CB_Running = 0;
     afs_CacheInit_Done = afs_Go_Done = 0;
     if (afs_cold_shutdown) {