afs: alloc openafs_lck_grp before osi_Init() on darwin 65/13065/3
authorMarcio Barbosa <mbarbosa@sinenomine.net>
Thu, 10 May 2018 03:46:01 +0000 (00:46 -0300)
committerBenjamin Kaduk <kaduk@mit.edu>
Tue, 15 May 2018 22:40:47 +0000 (18:40 -0400)
Commit a27bed59cae1a4244429c752edfde0a8363c8a3b moved init_hckernel_init
to osi_Init. On Darwin (AFS_DARWIN80_ENV), MUTEX_INIT
(called by init_hckernel_init) uses openafs_lck_grp as the argument of
one of the functions called during the initialization of the mutex in
question. Since openafs_lck_grp was not allocated yet, we crash.

To fix this problem, call MUTEX_SETUP() before osi_Init() on Darwin.

Change-Id: Ib53118208d3ca7982e712768f334299e3d948805
Reviewed-on: https://gerrit.openafs.org/13065
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/afs/DARWIN/osi_module.c

index 046870a..aa7785a 100644 (file)
@@ -50,9 +50,9 @@ kern_return_t
 afs_modload(struct kmod_info *kmod_info, void *data)
 {
     int ret;
-    osi_Init();
 #ifdef AFS_DARWIN80_ENV
     MUTEX_SETUP();
+    osi_Init();
     afs_global_lock = lck_mtx_alloc_init(openafs_lck_grp, 0);
 
     if (ret = vfs_fsadd(&afs_vfsentry, &afs_vfstable)) {
@@ -82,6 +82,7 @@ afs_modload(struct kmod_info *kmod_info, void *data)
        return KERN_FAILURE;
     }
 #else
+    osi_Init();
     memset(&afs_vfsconf, 0, sizeof(struct vfsconf));
     strcpy(afs_vfsconf.vfc_name, "afs");
     afs_vfsconf.vfc_vfsops = &afs_vfsops;