Skip to content

Commit 8607901

Browse files
committed
rcache/grdma: fix crash when part of a registration is unmapped
This commit fixes an issue when a registration is created for a large region and then invalidated while part of it is in use. References open-mpi#4509 Signed-off-by: Nathan Hjelm <[email protected]> (cherry picked from commit 39d5988) Signed-off-by: Nathan Hjelm <[email protected]>
1 parent d793f08 commit 8607901

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

opal/mca/rcache/grdma/rcache_grdma_module.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,11 @@ static int mca_rcache_grdma_deregister (mca_rcache_base_module_t *rcache,
415415
return OPAL_SUCCESS;
416416
}
417417

418-
rc = dereg_mem (reg);
418+
if (!(reg->flags & MCA_RCACHE_FLAGS_INVALID)) {
419+
/* only call dereg mem if this registration is not in the GC lifo */
420+
rc = dereg_mem (reg);
421+
}
422+
419423
opal_mutex_unlock (&rcache_grdma->cache->vma_module->vma_lock);
420424

421425
return rc;
@@ -450,7 +454,7 @@ static int gc_add (mca_rcache_base_registration_t *grdma_reg, void *ctx)
450454
/* This may be called from free() so avoid recursively calling into free by just
451455
* shifting this registration into the garbage collection list. The cleanup will
452456
* be done on the next registration attempt. */
453-
if (registration_is_cacheable (grdma_reg)) {
457+
if (registration_is_cacheable (grdma_reg) && !grdma_reg->ref_count) {
454458
opal_list_remove_item (&rcache_grdma->cache->lru_list, (opal_list_item_t *) grdma_reg);
455459
}
456460

0 commit comments

Comments
 (0)