From 0db7facffee0e07e096ad96f323608d752d3790a Mon Sep 17 00:00:00 2001 From: Robert Kim Yates Date: Wed, 23 Sep 1998 12:24:50 -0500 Subject: [svn-r716] Added barrier to H5F_istore_allocate to preclude racing with data writes. --- src/H5Distore.c | 17 +++++++++++++++++ src/H5Fistore.c | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/H5Distore.c b/src/H5Distore.c index 3a54612..dcd1d35 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -1998,6 +1998,9 @@ H5F_istore_get_addr (H5F_t *f, const H5O_layout_t *layout, * * Modifications: * + * rky 980923 + * Added barrier to preclude racing with data writes. + * *------------------------------------------------------------------------- */ herr_t @@ -2092,6 +2095,20 @@ H5F_istore_allocate (H5F_t *f, const H5O_layout_t *layout, if (carry) break; } + /* + * rky 980923 + * The following barrier is a temporary fix to prevent overwriting + * real data caused by a race between one proc's call of H5F_istore_allocate + * (from H5D_allocate, ultimately from H5Dcreate and H5Dextend) + * and another proc's call of H5Dwrite. + * Eventually, this barrier should be removed, + * when H5D_allocate is changed to call H5MF_alloc directly + * to allocate space, instead of calling H5F_istore_unlock. + */ + if (MPI_Barrier( f->shared->access_parms->u.mpio.comm )) { + HRETURN_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Barrier failed"); + } + FUNC_LEAVE(SUCCEED); } #endif diff --git a/src/H5Fistore.c b/src/H5Fistore.c index 3a54612..dcd1d35 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -1998,6 +1998,9 @@ H5F_istore_get_addr (H5F_t *f, const H5O_layout_t *layout, * * Modifications: * + * rky 980923 + * Added barrier to preclude racing with data writes. + * *------------------------------------------------------------------------- */ herr_t @@ -2092,6 +2095,20 @@ H5F_istore_allocate (H5F_t *f, const H5O_layout_t *layout, if (carry) break; } + /* + * rky 980923 + * The following barrier is a temporary fix to prevent overwriting + * real data caused by a race between one proc's call of H5F_istore_allocate + * (from H5D_allocate, ultimately from H5Dcreate and H5Dextend) + * and another proc's call of H5Dwrite. + * Eventually, this barrier should be removed, + * when H5D_allocate is changed to call H5MF_alloc directly + * to allocate space, instead of calling H5F_istore_unlock. + */ + if (MPI_Barrier( f->shared->access_parms->u.mpio.comm )) { + HRETURN_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Barrier failed"); + } + FUNC_LEAVE(SUCCEED); } #endif -- cgit v0.12