]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
demand-attach-init-fsstate-rwlock-20070712
authorDerrick Brashear <shadow@dementia.org>
Thu, 12 Jul 2007 09:28:26 +0000 (09:28 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 12 Jul 2007 09:28:26 +0000 (09:28 +0000)
the rwlock needs to be initd before use

src/viced/viced.c
src/viced/viced.h

index 45a7c9c5148b2153a9ea8220f73abad1e16be3b5..c4996f56bcbe570bed0ccb6d4ed99734a28c61f3 100644 (file)
@@ -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);
 
index e6e08a107a3aadb50c46d4a3647ecc37693b775f..e632bc87af27e1463d362228595b6d1665a16d88 100644 (file)
@@ -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)