From: Derrick Brashear Date: Thu, 12 Jul 2007 09:29:34 +0000 (+0000) Subject: DEVEL15-demand-attach-init-fsstate-rwlock-20070712 X-Git-Tag: openafs-devel-1_5_22~50 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=ce744b9a8294bf6f0f654a09f13a370d0e5a4b5a;p=packages%2Fo%2Fopenafs.git DEVEL15-demand-attach-init-fsstate-rwlock-20070712 the rwlock needs to be initd before use (cherry picked from commit 1e86d1f3cc8166b8303e208e3a12922d44061317) --- diff --git a/src/viced/viced.c b/src/viced/viced.c index 353fcc428..4a75a6751 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -2185,6 +2185,7 @@ main(int argc, char *argv[]) #ifdef AFS_PTHREAD_ENV ViceLog(5, ("Starting pthreads\n")); + FS_STATE_INIT; assert(pthread_attr_init(&tattr) == 0); assert(pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) == 0); diff --git a/src/viced/viced.h b/src/viced/viced.h index e6e08a107..e632bc87a 100644 --- a/src/viced/viced.h +++ b/src/viced/viced.h @@ -246,6 +246,7 @@ struct fs_state { extern struct fs_state fs_state; /* this lock is defined to be directly above FS_LOCK in the locking hierarchy */ +#define FS_STATE_INIT assert(pthread_rwlock_init(&fs_state.state_lock, NULL) == 0) #define FS_STATE_RDLOCK assert(pthread_rwlock_rdlock(&fs_state.state_lock) == 0) #define FS_STATE_WRLOCK assert(pthread_rwlock_wrlock(&fs_state.state_lock) == 0) #define FS_STATE_UNLOCK assert(pthread_rwlock_unlock(&fs_state.state_lock) == 0)