summaryrefslogtreecommitdiffstats
path: root/src/H5Dint.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2015-09-12 18:09:08 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2015-09-12 18:09:08 (GMT)
commitb3b06d2703eea051b0025c075f8c6742fcca1200 (patch)
treee5d30a77a8250c6bb67591e914611541df4cddc2 /src/H5Dint.c
parent806a3bfa7357d314d9736740c059deb5a89cad20 (diff)
downloadhdf5-b3b06d2703eea051b0025c075f8c6742fcca1200.zip
hdf5-b3b06d2703eea051b0025c075f8c6742fcca1200.tar.gz
hdf5-b3b06d2703eea051b0025c075f8c6742fcca1200.tar.bz2
[svn-r27765] Merges from trunk:
- VMS code removal: 27572 - Dataspace memory error: 27605 - Extraneous dataset flush: 27615 - Warning quieting: 27623 - Hyperslab error clarity: 27631 - Duplicate attribute macros: 27753 Tested on: koala w/ C++ and Fortran
Diffstat (limited to 'src/H5Dint.c')
-rw-r--r--src/H5Dint.c87
1 files changed, 47 insertions, 40 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 45d6ac9..2bf43d4 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -1634,7 +1634,7 @@ done:
herr_t
H5D_close(H5D_t *dataset)
{
- unsigned free_failed = FALSE;
+ hbool_t free_failed = FALSE;
hbool_t corked; /* Whether the dataset is corked or not */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1655,16 +1655,18 @@ H5D_close(H5D_t *dataset)
if(H5D__flush_real(dataset, H5AC_dxpl_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info")
- /* Free the data sieve buffer, if it's been allocated */
- if(dataset->shared->cache.contig.sieve_buf) {
- HDassert(dataset->shared->layout.type != H5D_COMPACT); /* We should never have a sieve buffer for compact storage */
-
- dataset->shared->cache.contig.sieve_buf = (unsigned char *)H5FL_BLK_FREE(sieve_buf,dataset->shared->cache.contig.sieve_buf);
- } /* end if */
+ /* Set a flag to indicate the dataset is closing, before we start freeing things */
+ /* (Avoids problems with flushing datasets twice, when one is holding
+ * the file open and it iterates through dataset to flush them -QAK)
+ */
+ dataset->shared->closing = TRUE;
/* Free cached information for each kind of dataset */
switch(dataset->shared->layout.type) {
case H5D_CONTIGUOUS:
+ /* Free the data sieve buffer, if it's been allocated */
+ if(dataset->shared->cache.contig.sieve_buf)
+ dataset->shared->cache.contig.sieve_buf = (unsigned char *)H5FL_BLK_FREE(sieve_buf,dataset->shared->cache.contig.sieve_buf);
break;
case H5D_CHUNKED:
@@ -1724,8 +1726,9 @@ H5D_close(H5D_t *dataset)
* Release datatype, dataspace and creation property list -- there isn't
* much we can do if one of these fails, so we just continue.
*/
- free_failed = (unsigned)(H5I_dec_ref(dataset->shared->type_id) < 0 || H5S_close(dataset->shared->space) < 0 ||
- H5I_dec_ref(dataset->shared->dcpl_id) < 0);
+ free_failed = (H5I_dec_ref(dataset->shared->type_id) < 0) ||
+ (H5S_close(dataset->shared->space) < 0) ||
+ (H5I_dec_ref(dataset->shared->dcpl_id) < 0);
/* Remove the dataset from the list of opened objects in the file */
if(H5FO_top_decr(dataset->oloc.file, dataset->oloc.addr) < 0)
@@ -2629,44 +2632,48 @@ H5D__flush_real(H5D_t *dataset, hid_t dxpl_id)
/* Check args */
HDassert(dataset);
+ HDassert(dataset->shared);
+
+ /* Avoid flushing the dataset (again) if it's closing */
+ if(!dataset->shared->closing) {
+ /* Check for metadata changes that will require updating the object's modification time */
+ if(dataset->shared->layout_dirty || dataset->shared->space_dirty) {
+ unsigned update_flags = H5O_UPDATE_TIME; /* Modification time flag */
+
+ /* Pin the object header */
+ if(NULL == (oh = H5O_pin(&dataset->oloc, dxpl_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header")
+
+ /* Update the layout on disk, if it's been changed */
+ if(dataset->shared->layout_dirty) {
+ if(H5D__layout_oh_write(dataset, dxpl_id, oh, update_flags) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout/pline/efl info")
+ dataset->shared->layout_dirty = FALSE;
+
+ /* Reset the "update the modification time" flag, so we only do it once */
+ update_flags = 0;
+ } /* end if */
- /* Check for metadata changes that will require updating the object's modification time */
- if(dataset->shared->layout_dirty || dataset->shared->space_dirty) {
- unsigned update_flags = H5O_UPDATE_TIME; /* Modification time flag */
-
- /* Pin the object header */
- if(NULL == (oh = H5O_pin(&dataset->oloc, dxpl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header")
-
- /* Update the layout on disk, if it's been changed */
- if(dataset->shared->layout_dirty) {
- if(H5D__layout_oh_write(dataset, dxpl_id, oh, update_flags) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout/pline/efl info")
- dataset->shared->layout_dirty = FALSE;
-
- /* Reset the "update the modification time" flag, so we only do it once */
- update_flags = 0;
- } /* end if */
+ /* Update the dataspace on disk, if it's been changed */
+ if(dataset->shared->space_dirty) {
+ if(H5S_write(dataset->oloc.file, dxpl_id, oh, update_flags, dataset->shared->space) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update file with new dataspace")
+ dataset->shared->space_dirty = FALSE;
- /* Update the dataspace on disk, if it's been changed */
- if(dataset->shared->space_dirty) {
- if(H5S_write(dataset->oloc.file, dxpl_id, oh, update_flags, dataset->shared->space) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update file with new dataspace")
- dataset->shared->space_dirty = FALSE;
+ /* Reset the "update the modification time" flag, so we only do it once */
+ update_flags = 0;
+ } /* end if */
- /* Reset the "update the modification time" flag, so we only do it once */
- update_flags = 0;
+ /* _Somebody_ should have update the modification time! */
+ HDassert(update_flags == 0);
} /* end if */
- /* _Somebody_ should have update the modification time! */
- HDassert(update_flags == 0);
+ /* Flush cached raw data for each kind of dataset layout */
+ if(dataset->shared->layout.ops->flush &&
+ (dataset->shared->layout.ops->flush)(dataset, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush raw data")
} /* end if */
- /* Flush cached raw data for each kind of dataset layout */
- if(dataset->shared->layout.ops->flush &&
- (dataset->shared->layout.ops->flush)(dataset, dxpl_id) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush raw data")
-
done:
/* Release pointer to object header */
if(oh != NULL)