| 
9 | 9 |  *                         University of Stuttgart.  All rights reserved.  | 
10 | 10 |  * Copyright (c) 2004-2005 The Regents of the University of California.  | 
11 | 11 |  *                         All rights reserved.  | 
12 |  | - * Copyright (c) 2013-2016 University of Houston. All rights reserved.  | 
 | 12 | + * Copyright (c) 2013-2017 University of Houston. All rights reserved.  | 
13 | 13 |  * Copyright (c) 2015      Research Organization for Information Science  | 
14 | 14 |  *                         and Technology (RIST). All rights reserved.  | 
15 | 15 |  * $COPYRIGHT$  | 
 | 
25 | 25 | 
 
  | 
26 | 26 | #include "mpi.h"  | 
27 | 27 | #include "ompi/constants.h"  | 
 | 28 | +#include "ompi/group/group.h"  | 
 | 29 | +#include "ompi/proc/proc.h"  | 
28 | 30 | #include "ompi/mca/sharedfp/sharedfp.h"  | 
29 | 31 | #include "ompi/mca/sharedfp/base/base.h"  | 
30 | 32 | 
 
  | 
@@ -99,8 +101,23 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm,  | 
99 | 101 |         return OMPI_ERR_OUT_OF_RESOURCE;  | 
100 | 102 |     }  | 
101 | 103 | 
 
  | 
102 |  | -    lockedfilename = (char*)malloc(sizeof(char) * (strlen(filename) + 64));  | 
103 |  | -    sprintf(lockedfilename,"%s%s",filename,".lockedfile");  | 
 | 104 | +    opal_jobid_t masterjobid;  | 
 | 105 | +    if ( 0 == comm->c_my_rank  ) {  | 
 | 106 | +        ompi_proc_t *masterproc = ompi_group_peer_lookup(comm->c_local_group, 0 );  | 
 | 107 | +        masterjobid = OMPI_CAST_RTE_NAME(&masterproc->super.proc_name)->jobid;  | 
 | 108 | +    }  | 
 | 109 | +    comm->c_coll->coll_bcast ( &masterjobid, 1, MPI_UNSIGNED, 0, comm,   | 
 | 110 | +                               comm->c_coll->coll_bcast_module );  | 
 | 111 | +   | 
 | 112 | +    size_t filenamelen = strlen(filename) + 16;  | 
 | 113 | +    lockedfilename = (char*)malloc(sizeof(char) * filenamelen);  | 
 | 114 | +    if ( NULL == lockedfilename ) {  | 
 | 115 | +	free (shfileHandle);  | 
 | 116 | +	free (sh);  | 
 | 117 | +        free (module_data);  | 
 | 118 | +        return OMPI_ERR_OUT_OF_RESOURCE;  | 
 | 119 | +    }  | 
 | 120 | +    snprintf(lockedfilename, filenamelen, "%s-%u%s",filename,masterjobid,".lock");  | 
104 | 121 |     module_data->filename = lockedfilename;  | 
105 | 122 | 
 
  | 
106 | 123 |     /*-------------------------------------------------*/  | 
 | 
0 commit comments