summaryrefslogtreecommitdiffstats
path: root/src/H5FDfamily.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2016-11-29 00:34:36 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2016-11-29 00:34:36 (GMT)
commitb092dbcdfdfc7477596ae49f816f18e0dadf0fb1 (patch)
treeb2ddd93f609d6449936475e41529ad021038b217 /src/H5FDfamily.c
parenta6ab26c74b29fff10e6a40bb351eb4a6eaa24162 (diff)
downloadhdf5-b092dbcdfdfc7477596ae49f816f18e0dadf0fb1.zip
hdf5-b092dbcdfdfc7477596ae49f816f18e0dadf0fb1.tar.gz
hdf5-b092dbcdfdfc7477596ae49f816f18e0dadf0fb1.tar.bz2
Bring over another batch (hopefully the last) of non-SWMR "normalization"
changes from the revise_chunks branch.
Diffstat (limited to 'src/H5FDfamily.c')
-rw-r--r--src/H5FDfamily.c47
1 files changed, 25 insertions, 22 deletions
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 7ec8751..f0d4dba 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -1339,33 +1339,37 @@ done:
static herr_t
H5FD_family_lock(H5FD_t *_file, hbool_t rw)
{
- H5FD_family_t *file = (H5FD_family_t *)_file; /* VFD file struct */
- unsigned u, i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5FD_family_t *file = (H5FD_family_t *)_file; /* VFD file struct */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Place the lock on all the member files */
- for(u = 0; u < file->nmembs; u++) {
- if(file->memb[u]) {
+ for(u = 0; u < file->nmembs; u++)
+ if(file->memb[u])
if(H5FD_lock(file->memb[u], rw) < 0)
- break;
- } /* end if */
- } /* end for */
+ break;
- if(u < file->nmembs) { /* Try to unlock the member files done before */
- for(i = 0; i < u; i++) {
- if(H5FD_unlock(file->memb[i]) < 0)
- /* Push error, but keep going*/
- HDONE_ERROR(H5E_IO, H5E_CANTUNLOCK, FAIL, "unable to unlock member files")
- }
- HGOTO_ERROR(H5E_IO, H5E_CANTLOCK, FAIL, "unable to lock member files")
+ /* If one of the locks failed, try to unlock the locked member files
+ * in an attempt to return to a fully unlocked state.
+ */
+ if(u < file->nmembs) {
+ unsigned v; /* Local index variable */
+
+ for(v = 0; v < v; v++) {
+ if(H5FD_unlock(file->memb[v]) < 0)
+ /* Push error, but keep going */
+ HDONE_ERROR(H5E_IO, H5E_CANTUNLOCK, FAIL, "unable to unlock member files")
+ } /* end for */
+ HGOTO_ERROR(H5E_IO, H5E_CANTLOCK, FAIL, "unable to lock member files")
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_family_lock() */
+
/*-------------------------------------------------------------------------
* Function: H5FD_family_unlock
*
@@ -1381,19 +1385,18 @@ static herr_t
H5FD_family_unlock(H5FD_t *_file)
{
H5FD_family_t *file = (H5FD_family_t *)_file; /* VFD file struct */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Remove the lock on the member files */
- for(u = 0; u < file->nmembs; u++) {
- if(file->memb[u]) {
+ for(u = 0; u < file->nmembs; u++)
+ if(file->memb[u])
if(H5FD_unlock(file->memb[u]) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTUNLOCK, FAIL, "unable to unlock member files")
- } /* end if */
- } /* end for */
+ HGOTO_ERROR(H5E_IO, H5E_CANTUNLOCK, FAIL, "unable to unlock member files")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_family_unlock() */
+