From: Marcio Barbosa Date: Thu, 10 May 2018 03:46:01 +0000 (-0300) Subject: afs: alloc openafs_lck_grp before osi_Init() on darwin X-Git-Tag: upstream/1.8.1_pre2^2~33 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=ecc94cdf1b79f49e87b4147cd9301f7dcb2af735;p=packages%2Fo%2Fopenafs.git afs: alloc openafs_lck_grp before osi_Init() on darwin 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. Reviewed-on: https://gerrit.openafs.org/13065 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 8e740aed774d4507e656e6ae743f6c6fe6c0e356) Change-Id: Ic1c58b5e2baeedd1cd24c364dd2907761064c8a9 Reviewed-on: https://gerrit.openafs.org/13115 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk --- diff --git a/src/afs/DARWIN/osi_module.c b/src/afs/DARWIN/osi_module.c index 046870a7f..aa7785aac 100644 --- a/src/afs/DARWIN/osi_module.c +++ b/src/afs/DARWIN/osi_module.c @@ -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;