]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE12-rx-thread-id-assignment-fixes-20030203
authorRainer Toebbicke <rtb@pclella.cern.ch>
Mon, 3 Feb 2003 20:46:18 +0000 (20:46 +0000)
committerDerrick Brashear <shadow@dementia.org>
Mon, 3 Feb 2003 20:46:18 +0000 (20:46 +0000)
in rx_pthread.c the
++rxi_pthread_hinum;
has to be protected by the rx_stats_mutex in all three cases. In the file I
attached in the openafs-devel article the last one was accidentally
unprotected.

the FSYNC_sync thread (fssync.c) needs needs to be handled as well.

(cherry picked from commit cff48dcb5210e38e0048a04fc3151d045bdca4ce)

src/rx/rx_pthread.c
src/vol/fssync.c

index da4a5d181646abfe763cf0c890ec499a36942d28..44f7135bd1a62ce9d601fa339f0c1890a370907b 100644 (file)
@@ -377,7 +377,9 @@ rxi_Listen(sock)
        printf("Unable to create socket listener thread\n");
        exit(1);
     }
+    MUTEX_ENTER(&rx_stats_mutex);
     ++rxi_pthread_hinum;
+    MUTEX_EXIT(&rx_stats_mutex);
     AFS_SIGSET_RESTORE();
     return 0;
 }
index 0a2fb389a7c3226def0c1f4f6de961f574712086..701c31ed38cb0c7e019b65aa7feb53ea8fc8681d 100644 (file)
@@ -252,10 +252,23 @@ static void FSYNC_sync() {
     extern VInit;
     int code;
     int numTries;
+#ifdef AFS_PTHREAD_ENV
+    int tid;
+#endif
 
 #ifndef AFS_NT40_ENV
     signal(SIGPIPE, SIG_IGN);
 #endif
+
+#ifdef AFS_PTHREAD_ENV
+    /* set our 'thread-id' so that the host hold table works */ 
+    MUTEX_ENTER(&rx_stats_mutex);   /* protects rxi_pthread_hinum */
+    tid=++rxi_pthread_hinum;
+    MUTEX_EXIT(&rx_stats_mutex);
+    pthread_setspecific(rx_thread_id_key, (void *)tid);
+    Log("Set thread id %d for FSYNC_sync\n", tid);
+#endif /* AFS_PTHREAD_ENV */
+
     while (!VInit) {
       /* Let somebody else run until level > 0.  That doesn't mean that 
        * all volumes have been attached. */