@@ -78,9 +78,15 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm,
78
78
ompi_proc_t * masterproc = ompi_group_peer_lookup (comm -> c_local_group , 0 );
79
79
masterjobid = OMPI_CAST_RTE_NAME (& masterproc -> super .proc_name )-> jobid ;
80
80
}
81
- comm -> c_coll -> coll_bcast ( & masterjobid , 1 , MPI_UNSIGNED , 0 , comm ,
82
- comm -> c_coll -> coll_bcast_module );
83
-
81
+ err = comm -> c_coll -> coll_bcast ( & masterjobid , 1 , MPI_UNSIGNED , 0 , comm ,
82
+ comm -> c_coll -> coll_bcast_module );
83
+ if ( OMPI_SUCCESS != err ) {
84
+ opal_output (0 , "[%d]mca_sharedfp_lockedfile_file_open: Error in bcast operation\n" , fh -> f_rank );
85
+ free (sh );
86
+ free (module_data );
87
+ return err ;
88
+ }
89
+
84
90
size_t filenamelen = strlen (filename ) + 16 ;
85
91
lockedfilename = (char * )malloc (sizeof (char ) * filenamelen );
86
92
if ( NULL == lockedfilename ) {
@@ -100,16 +106,33 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm,
100
106
*therefore there is no need to lock the file
101
107
*/
102
108
handle = open ( lockedfilename , O_RDWR | O_CREAT , 0644 );
109
+ if ( -1 == handle ){
110
+ opal_output (0 , "[%d]mca_sharedfp_lockedfile_file_open: Error during file open\n" ,
111
+ fh -> f_rank );
112
+ free (sh );
113
+ free (module_data );
114
+ free (lockedfilename );
115
+ return OMPI_ERROR ;
116
+ }
103
117
write ( handle , & position , sizeof (OMPI_MPI_OFFSET_TYPE ) );
104
118
close ( handle );
105
119
}
106
- comm -> c_coll -> coll_barrier ( comm , comm -> c_coll -> coll_barrier_module );
120
+ err = comm -> c_coll -> coll_barrier ( comm , comm -> c_coll -> coll_barrier_module );
121
+ if ( OMPI_SUCCESS != err ) {
122
+ opal_output (0 , "[%d]mca_sharedfp_lockedfile_file_open: Error in barrier operation\n" , fh -> f_rank );
123
+ free (sh );
124
+ free (module_data );
125
+ free (lockedfilename );
126
+ return err ;
127
+ }
107
128
108
129
handle = open ( lockedfilename , O_RDWR , 0644 );
109
130
if ( -1 == handle ) {
110
- opal_output (0 , "[%d]mca_sharedfp_lockedfile_file_open: Error during file open\n" , fh -> f_rank );
131
+ opal_output (0 , "[%d]mca_sharedfp_lockedfile_file_open: Error during file open\n" ,
132
+ fh -> f_rank );
111
133
free (sh );
112
134
free (module_data );
135
+ free (lockedfilename );
113
136
return OMPI_ERROR ;
114
137
}
115
138
@@ -120,9 +143,7 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm,
120
143
/*remember the shared file handle*/
121
144
fh -> f_sharedfp_data = sh ;
122
145
123
- comm -> c_coll -> coll_barrier ( comm , comm -> c_coll -> coll_barrier_module );
124
-
125
- return err ;
146
+ return comm -> c_coll -> coll_barrier ( comm , comm -> c_coll -> coll_barrier_module );
126
147
}
127
148
128
149
int mca_sharedfp_lockedfile_file_close (ompio_file_t * fh )
0 commit comments