Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

btl_sm: add a comment explaining why we rename(2) #882

Merged
merged 1 commit into from
Jan 4, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions opal/mca/btl/sm/btl_sm_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2007 Voltaire. All rights reserved.
* Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010-2015 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2011-2014 NVIDIA Corporation. All rights reserved.
Expand Down Expand Up @@ -650,7 +650,13 @@ create_rndv_file(mca_btl_sm_component_t *comp_ptr,
* file containing all the meta info required for attach. */

/* now just write the contents of tmp_modp->shmem_ds to the full
* sizeof(opal_shmem_ds_t), so we know where the mpool_res_size starts. */
* sizeof(opal_shmem_ds_t), so we know where the mpool_res_size
* starts. Note that we write into a temporary file first and
* then do a rename(2) to move the full file into its final
* destination. This avoids a race condition where a peer process
* might open/read part of the file before this processes finishes
* writing it (see
* https://github.com/open-mpi/ompi/issues/1230). */
asprintf(&tmpfname, "%s.tmp", fname);
if (NULL == tmpfname) {
rc = OPAL_ERR_OUT_OF_RESOURCE;
Expand Down