fix bug in file delete and access where only rank 0 is calling those functions.

remove the bcasts for the error code since the other ranks are not calling it.

Signed-off-by: Mohamad Chaarawi <mohamad.chaarawi@intel.com>
master
Mohamad Chaarawi 2019-04-15 22:14:33 +00:00
parent e295a4e45f
commit 5797624d56
1 changed files with 21 additions and 37 deletions

View File

@ -173,6 +173,7 @@ HandleDistribute(daos_handle_t *handle, enum handleType type)
MPI_COMM_WORLD), MPI_COMM_WORLD),
"Failed to bcast global handle buffer size"); "Failed to bcast global handle buffer size");
global.iov_len = global.iov_buf_len;
global.iov_buf = malloc(global.iov_buf_len); global.iov_buf = malloc(global.iov_buf_len);
if (global.iov_buf == NULL) if (global.iov_buf == NULL)
ERR("Failed to allocate global handle buffer"); ERR("Failed to allocate global handle buffer");
@ -192,9 +193,6 @@ HandleDistribute(daos_handle_t *handle, enum handleType type)
"Failed to bcast global pool handle"); "Failed to bcast global pool handle");
if (rank != 0) { if (rank != 0) {
/* A larger-than-actual length works just fine. */
global.iov_len = global.iov_buf_len;
if (type == POOL_HANDLE) if (type == POOL_HANDLE)
rc = daos_pool_global2local(global, handle); rc = daos_pool_global2local(global, handle);
else if (type == CONT_HANDLE) else if (type == CONT_HANDLE)
@ -384,30 +382,22 @@ static int
DAOS_Access(const char *testFileName, int mode, IOR_param_t * param) DAOS_Access(const char *testFileName, int mode, IOR_param_t * param)
{ {
daos_obj_id_t oid; daos_obj_id_t oid;
daos_size_t cell_size, chunk_size;
int rc; int rc;
/** Convert file name into object ID */ /** Convert file name into object ID */
gen_oid(testFileName, &oid); gen_oid(testFileName, &oid);
/** open the array to verify it exists */ rc = daos_array_open(coh, oid, DAOS_TX_NONE, DAOS_OO_RO,
if (param->filePerProc || rank == 0) { &cell_size, &chunk_size, &aoh, NULL);
daos_size_t cell_size, chunk_size; if (rc)
return rc;
rc = daos_array_open(coh, oid, DAOS_TX_NONE, DAOS_OO_RO, if (cell_size != 1)
&cell_size, &chunk_size, &aoh, NULL); GERR("Invalid DAOS Array object.\n");
if (rc)
return rc;
if (cell_size != 1)
GERR("Invalid DAOS Array object.\n");
rc = daos_array_close(aoh, NULL);
aoh.cookie = 0;
}
if (!param->filePerProc)
MPI_Bcast(&rc, 1, MPI_INT, 0, MPI_COMM_WORLD);
rc = daos_array_close(aoh, NULL);
aoh.cookie = 0;
return rc; return rc;
} }
@ -487,6 +477,7 @@ static void
DAOS_Delete(char *testFileName, IOR_param_t *param) DAOS_Delete(char *testFileName, IOR_param_t *param)
{ {
daos_obj_id_t oid; daos_obj_id_t oid;
daos_size_t cell_size, chunk_size;
int rc; int rc;
if (!daos_initialized) if (!daos_initialized)
@ -496,26 +487,19 @@ DAOS_Delete(char *testFileName, IOR_param_t *param)
gen_oid(testFileName, &oid); gen_oid(testFileName, &oid);
/** open the array to verify it exists */ /** open the array to verify it exists */
if (param->filePerProc || rank == 0) { rc = daos_array_open(coh, oid, DAOS_TX_NONE, DAOS_OO_RW,
daos_size_t cell_size, chunk_size; &cell_size, &chunk_size, &aoh, NULL);
DCHECK(rc, "daos_array_open() failed (%d).", rc);
rc = daos_array_open(coh, oid, DAOS_TX_NONE, DAOS_OO_RW, if (cell_size != 1)
&cell_size, &chunk_size, &aoh, NULL); GERR("Invalid DAOS Array object.\n");
DCHECK(rc, "daos_array_open() failed (%d).", rc);
if (cell_size != 1) rc = daos_array_destroy(aoh, DAOS_TX_NONE, NULL);
GERR("Invalid DAOS Array object.\n"); DCHECK(rc, "daos_array_destroy() failed (%d).", rc);
rc = daos_array_destroy(aoh, DAOS_TX_NONE, NULL); rc = daos_array_close(aoh, NULL);
DCHECK(rc, "daos_array_destroy() failed (%d).", rc); DCHECK(rc, "daos_array_close() failed (%d).", rc);
aoh.cookie = 0;
rc = daos_array_close(aoh, NULL);
DCHECK(rc, "daos_array_close() failed (%d).", rc);
aoh.cookie = 0;
}
if (!param->filePerProc)
MPI_Bcast(&rc, 1, MPI_INT, 0, MPI_COMM_WORLD);
} }
static char * static char *