]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afs: Move init_hckernel_init to osi_Init
authorAndrew Deason <adeason@sinenomine.net>
Thu, 25 Sep 2014 17:34:18 +0000 (12:34 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Fri, 26 Sep 2014 14:12:58 +0000 (10:12 -0400)
Currently we call init_hckernel_init inside afs_InitSetup, to
initialize the hcrypto mutex. However, we use the hcrypto mutex in the
AFSOP_SEED_ENTROPY syscall, which afsd calls before any syscall that
cals afs_InitSetup. This means we crash on trying to
AFSOP_SEED_ENTROPY.

To avoid this, just call init_hckernel_init inside osi_Init instead,
which is called when our kernel module itself is initialized. This
ensures that the mutex is initialized early on, regardless of what
happens with afsd and the startup syscalls.

Change-Id: Ib6cbed7abcfd8f9a61685f613a848e9f36d6050d
Reviewed-on: http://gerrit.openafs.org/11509
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
src/afs/afs_call.c
src/afs/afs_osi.c

index f3448ed84e3693ab0a3e1b74bc15040a2b430ece..43d777851082e822a00f5c3c4669d1f57603e86b 100644 (file)
 #endif
 #include <hcrypto/rand.h>
 
-/* No hckernel-specific header for this prototype. */
-#ifndef UKERNEL
-extern void init_hckernel_mutex(void);
-#endif
-
 #if defined(AFS_SUN5_ENV) || defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_HPUX_ENV)
 #define        AFS_MINBUFFERS  100
 #else
@@ -107,11 +102,6 @@ afs_InitSetup(int preallocs)
     if (afs_InitSetup_done)
        return EAGAIN;
 
-    /* Initialize a lock for the kernel hcrypto bits. */
-#ifndef UKERNEL
-    init_hckernel_mutex();
-#endif
-
 #ifdef AFS_SUN510_ENV
     /* Initialize a RW lock for the ifinfo global array */
     rw_init(&afsifinfo_lock, NULL, RW_DRIVER, NULL);
index 3eb176b8e401318266327df47d95dc8d7d81ce65..93983766f21f8a052e669049a00299cc9a60494e 100644 (file)
  *     -- On HP called from afsc_link.
  *     -- On SGI called from afs_init. */
 
+/* No hckernel-specific header for this prototype. */
+#ifndef UKERNEL
+extern void init_hckernel_mutex(void);
+#endif
+
 afs_lock_t afs_ftf;            /* flush text lock */
 
 #ifdef AFS_SGI53_ENV
@@ -78,6 +83,12 @@ osi_Init(void)
 
     osi_InitGlock();
 
+    /* Initialize a lock for the kernel hcrypto bits. */
+#ifndef UKERNEL
+    init_hckernel_mutex();
+#endif
+
+
     if (!afs_osicred_initialized) {
 #if defined(AFS_DARWIN80_ENV)
         afs_osi_ctxtp_initialized = 0;