Skip to content

Commit 9144211

Browse files
committed
sharedfp/sm: close the named semaphore
in case a named semaphore is used, it is necessary to close the semaphore to remove all sm segments. sem_unlink just removes the name references once all proceeses have closed the sem. Fixes issue: #4336 Signed-off-by: Edgar Gabriel <[email protected]> sharedfp/sm: unlink only needs to be called by one process Signed-off-by: Edgar Gabriel <[email protected]>
1 parent 0b0fedf commit 9144211

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm,
235235

236236
comm->c_coll.coll_barrier (comm, comm->c_coll.coll_barrier_module );
237237

238+
#if defined(HAVE_SEM_OPEN)
239+
if ( 0 == rank ) {
240+
sem_unlink ( sm_data->sem_name);
241+
}
242+
#endif
243+
238244
return err;
239245
}
240246

@@ -267,7 +273,7 @@ int mca_sharedfp_sm_file_close (mca_io_ompio_file_t *fh)
267273
if (file_data->sm_offset_ptr) {
268274
/* destroy semaphore */
269275
#if defined(HAVE_SEM_OPEN)
270-
sem_unlink (file_data->sem_name);
276+
sem_close ( file_data->mutex);
271277
free (file_data->sem_name);
272278
#elif defined(HAVE_SEM_INIT)
273279
sem_destroy(&file_data->sm_offset_ptr->mutex);

0 commit comments

Comments
 (0)