[OpenAFS-devel] Multi-threaded butc hangs - includes bucoord/status.o which is not thread-safe

Rainer Toebbicke rtb@pclella.cern.ch
Tue, 23 Jul 2002 10:53:54 +0200


This is a multi-part message in MIME format.
--------------020106040905070500080104
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

The multithreaded butc (src/tbutc/butc) includes bucoord/status.o, which is 
compiled together with the other bucoord stuff without MT_CFLAGS and hence 
without AFS_PTHREAD_ENV defined. Alas, it uses ObtainWriteLock and other 
macros out of lock.h which *are* sensitive to AFS_PTHREAD_ENV. Consequently, 
butc can hang trying to acquire the statusQueueLock when dumping volumes, in 
particular if 'backup status' commands are issued frequently.

A proper fix would probably be to push some of those macros out of lock.h and 
make them subroutines in lock.c.

A quick fix is ensuring status.c gets recompiled in tbutc/Makefile.in (see 
attached diff).


Rainer Toebbicke
IT Division
CERN, Geneva (Switzerland)




--------------020106040905070500080104
Content-Type: text/plain;
 name="tbutc-hangs-on-statusQueueLock"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="tbutc-hangs-on-statusQueueLock"

*** openafs/src/tbutc/Makefile.in.orig	Fri Jul  5 15:07:11 2002
--- openafs/src/tbutc/Makefile.in	Fri Jul  5 15:08:22 2002
***************
*** 45,51 ****
  VOLSER  = ../volser
  
  BUCOORDOBJS=ubik_db_if.o ${BUCOORD}/volstub.o ${BUCOORD}/dlq.o \
! 	    ${BUCOORD}/status.o ${BUCOORD}/bucoord_errs.o
  
  VOLSERLIBOBJ=${VOLSER}/volint.cs.o  vsprocs.o              ${VOLSER}/vsutils.o \
              ${VOLSER}/lockprocs.o  ${VOLSER}/volint.xdr.o ${VOLSER}/volerr.o \
--- 45,51 ----
  VOLSER  = ../volser
  
  BUCOORDOBJS=ubik_db_if.o ${BUCOORD}/volstub.o ${BUCOORD}/dlq.o \
! 	    status.o ${BUCOORD}/bucoord_errs.o
  
  VOLSERLIBOBJ=${VOLSER}/volint.cs.o  vsprocs.o              ${VOLSER}/vsutils.o \
              ${VOLSER}/lockprocs.o  ${VOLSER}/volint.xdr.o ${VOLSER}/volerr.o \
***************
*** 137,142 ****
--- 137,145 ----
  
  ubik_db_if.o: ${BUCOORD}/ubik_db_if.c
  	${CC} ${CFLAGS} -c ${BUCOORD}/ubik_db_if.c
+ 
+ status.o: ${BUCOORD}/status.c
+ 	${CC} ${CFLAGS} -c ${BUCOORD}/status.c
  
  vsprocs.o: ${VOLSER}/vsprocs.c
  	${CC} ${CFLAGS} -c ${VOLSER}/vsprocs.c

--------------020106040905070500080104--