summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2010-09-09 18:15:36 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2010-09-09 18:15:36 (GMT)
commit073eb187d6589e5741065038d3f4ca3f634381d9 (patch)
treec8907e2e4ea22075a85b8ea8d264a53d10c681c3 /src
parentbed127641399ec6c6e1479b7c394fd3a4eb56438 (diff)
downloadhdf5-073eb187d6589e5741065038d3f4ca3f634381d9.zip
hdf5-073eb187d6589e5741065038d3f4ca3f634381d9.tar.gz
hdf5-073eb187d6589e5741065038d3f4ca3f634381d9.tar.bz2
[svn-r19363] When mandatory filter failed to write data chunks, the dataset
couldn't close (bug 1260). The fix releases all resources and closes the dataset but returns a failure. Tested with h5committest - jam, heiwa, amani.
Diffstat (limited to 'src')
-rw-r--r--src/H5A.c12
-rw-r--r--src/H5AC.c6
-rw-r--r--src/H5Aint.c4
-rw-r--r--src/H5D.c32
-rw-r--r--src/H5Dchunk.c16
-rw-r--r--src/H5Dcompact.c8
-rw-r--r--src/H5Dcontig.c8
-rw-r--r--src/H5Dfill.c6
-rw-r--r--src/H5Dint.c21
-rw-r--r--src/H5E.c8
-rw-r--r--src/H5Eint.c6
-rw-r--r--src/H5F.c8
-rw-r--r--src/H5FD.c6
-rw-r--r--src/H5FDfamily.c8
-rw-r--r--src/H5G.c8
-rw-r--r--src/H5Gdeprec.c2
-rw-r--r--src/H5Gname.c4
-rw-r--r--src/H5Gtraverse.c8
-rw-r--r--src/H5I.c29
-rw-r--r--src/H5Iprivate.h2
-rw-r--r--src/H5L.c4
-rw-r--r--src/H5Lexternal.c4
-rw-r--r--src/H5O.c4
-rw-r--r--src/H5Ofill.c20
-rw-r--r--src/H5Olink.c4
-rw-r--r--src/H5P.c4
-rw-r--r--src/H5Pdcpl.c4
-rw-r--r--src/H5Plapl.c6
-rw-r--r--src/H5R.c2
-rw-r--r--src/H5S.c2
-rw-r--r--src/H5T.c26
-rw-r--r--src/H5Tcommit.c2
-rw-r--r--src/H5Tconv.c12
-rw-r--r--src/H5Z.c2
34 files changed, 159 insertions, 139 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 722af25..762371f 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -1030,9 +1030,9 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id)
done:
/* Release resources */
if(src_id >= 0)
- (void)H5I_dec_ref(src_id, FALSE);
+ (void)H5I_dec_ref(src_id, FALSE, FALSE);
if(dst_id >= 0)
- (void)H5I_dec_ref(dst_id, FALSE);
+ (void)H5I_dec_ref(dst_id, FALSE, FALSE);
if(tconv_buf && !tconv_owned)
tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf);
if(bkg_buf)
@@ -1176,9 +1176,9 @@ H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id)
done:
/* Release resources */
if(src_id >= 0)
- (void)H5I_dec_ref(src_id, FALSE);
+ (void)H5I_dec_ref(src_id, FALSE, FALSE);
if(dst_id >= 0)
- (void)H5I_dec_ref(dst_id, FALSE);
+ (void)H5I_dec_ref(dst_id, FALSE, FALSE);
if(tconv_buf)
tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf);
if(bkg_buf)
@@ -2047,7 +2047,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
done:
/* Release resources */
if(obj_loc_id > 0) {
- if(H5I_dec_ref(obj_loc_id, TRUE) < 0)
+ if(H5I_dec_ref(obj_loc_id, TRUE, FALSE) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "unable to close temporary object")
} /* end if */
else if(loc_found && H5G_loc_free(&obj_loc) < 0)
@@ -2271,7 +2271,7 @@ H5Aclose(hid_t attr_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
/* Decrement references to that atom (and close it) */
- if(H5I_dec_ref(attr_id, TRUE) < 0)
+ if(H5I_dec_ref(attr_id, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "can't close attribute")
done:
diff --git a/src/H5AC.c b/src/H5AC.c
index 42b1a11..933de2c 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -385,9 +385,9 @@ H5AC_term_interface(void)
n = 1; /* H5I */
/* Close H5AC dxpl */
- if (H5I_dec_ref(H5AC_dxpl_id, FALSE) < 0 ||
- H5I_dec_ref(H5AC_noblock_dxpl_id, FALSE) < 0 ||
- H5I_dec_ref(H5AC_ind_dxpl_id, FALSE) < 0)
+ if (H5I_dec_ref(H5AC_dxpl_id, FALSE, FALSE) < 0 ||
+ H5I_dec_ref(H5AC_noblock_dxpl_id, FALSE, FALSE) < 0 ||
+ H5I_dec_ref(H5AC_ind_dxpl_id, FALSE, FALSE) < 0)
H5E_clear_stack(NULL); /*ignore error*/
else {
/* Reset static IDs */
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 101d604..0d2a2cb 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -1029,7 +1029,7 @@ H5A_attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_si
done:
if(buf_sid > 0)
- if(H5I_dec_ref(buf_sid, FALSE) < 0)
+ if(H5I_dec_ref(buf_sid, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "Can't decrement temporary dataspace ID")
if(tid_src > 0)
/* Don't decrement ID, we want to keep underlying datatype */
@@ -1041,7 +1041,7 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "Can't decrement temporary datatype ID")
if(tid_mem > 0)
/* Decrement the memory datatype ID, it's transient */
- if(H5I_dec_ref(tid_mem, FALSE) < 0)
+ if(H5I_dec_ref(tid_mem, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "Can't decrement temporary datatype ID")
if(buf)
buf = H5FL_BLK_FREE(attr_buf, buf);
diff --git a/src/H5D.c b/src/H5D.c
index 30ce594..1b6ceed 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -378,9 +378,13 @@ H5Dclose(hid_t dset_id)
/*
* Decrement the counter on the dataset. It will be freed if the count
- * reaches zero.
+ * reaches zero.
+ *
+ * Pass in TRUE for the 3rd parameter to tell the function to remove
+ * dataset's ID even though the freeing function might fail. Please
+ * see the comments in H5I_dec_ref for details. (SLU - 2010/9/7)
*/
- if(H5I_dec_ref(dset_id, TRUE) < 0)
+ if(H5I_dec_ref(dset_id, TRUE, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't free")
done:
@@ -604,30 +608,30 @@ H5Dget_create_plist(hid_t dset_id)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register datatype")
src_id = H5I_register(H5I_DATATYPE, H5T_copy(dset->shared->type, H5T_COPY_ALL), FALSE);
if(src_id < 0) {
- H5I_dec_ref(dst_id, FALSE);
+ H5I_dec_ref(dst_id, FALSE, FALSE);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register datatype")
} /* end if */
/* Allocate a background buffer */
bkg_size = MAX(H5T_GET_SIZE(copied_fill.type), H5T_GET_SIZE(dset->shared->type));
if(H5T_path_bkg(tpath) && NULL == (bkg_buf = H5FL_BLK_CALLOC(type_conv, bkg_size))) {
- H5I_dec_ref(src_id, FALSE);
- H5I_dec_ref(dst_id, FALSE);
+ H5I_dec_ref(src_id, FALSE, FALSE);
+ H5I_dec_ref(dst_id, FALSE, FALSE);
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
} /* end if */
/* Convert fill value */
if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, copied_fill.buf, bkg_buf, H5AC_ind_dxpl_id) < 0) {
- H5I_dec_ref(src_id, FALSE);
- H5I_dec_ref(dst_id, FALSE);
+ H5I_dec_ref(src_id, FALSE, FALSE);
+ H5I_dec_ref(dst_id, FALSE, FALSE);
if(bkg_buf)
bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf);
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed")
} /* end if */
/* Release local resources */
- H5I_dec_ref(src_id, FALSE);
- H5I_dec_ref(dst_id, FALSE);
+ H5I_dec_ref(src_id, FALSE, FALSE);
+ H5I_dec_ref(dst_id, FALSE, FALSE);
if(bkg_buf)
bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf);
} /* end if */
@@ -643,7 +647,7 @@ H5Dget_create_plist(hid_t dset_id)
done:
if(ret_value < 0)
if(new_dcpl_id > 0)
- (void)H5I_dec_ref(new_dcpl_id, TRUE);
+ (void)H5I_dec_ref(new_dcpl_id, TRUE, FALSE);
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_create_plist() */
@@ -722,7 +726,7 @@ H5Dget_access_plist(hid_t dset_id)
done:
if(ret_value < 0)
if(new_dapl_id >= 0)
- (void)H5I_dec_ref(new_dapl_id, TRUE);
+ (void)H5I_dec_ref(new_dapl_id, TRUE, FALSE);
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_access_plist() */
@@ -1029,11 +1033,11 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
done:
if(vlen_bufsize.fspace_id > 0) {
- if(H5I_dec_ref(vlen_bufsize.fspace_id, FALSE) < 0)
+ if(H5I_dec_ref(vlen_bufsize.fspace_id, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
} /* end if */
if(vlen_bufsize.mspace_id > 0) {
- if(H5I_dec_ref(vlen_bufsize.mspace_id, FALSE) < 0)
+ if(H5I_dec_ref(vlen_bufsize.mspace_id, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
} /* end if */
if(vlen_bufsize.fl_tbuf != NULL)
@@ -1041,7 +1045,7 @@ done:
if(vlen_bufsize.vl_tbuf != NULL)
vlen_bufsize.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.vl_tbuf);
if(vlen_bufsize.xfer_pid > 0) {
- if(H5I_dec_ref(vlen_bufsize.xfer_pid, FALSE) < 0)
+ if(H5I_dec_ref(vlen_bufsize.xfer_pid, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement ref count on property list")
} /* end if */
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 0ccffa8..8bcd359 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -825,7 +825,7 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
} /* end if */
if(f_tid!=(-1)) {
- if(H5I_dec_ref(f_tid, FALSE) < 0)
+ if(H5I_dec_ref(f_tid, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
} /* end if */
if(file_space_normalized) {
@@ -2488,7 +2488,7 @@ H5D_chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *
if(flush) {
/* Flush */
if(H5D_chunk_flush_entry(dset, dxpl_id, dxpl_cache, ent, TRUE) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer")
+ HDONE_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer")
} /* end if */
else {
/* Don't flush, just free chunk */
@@ -4634,16 +4634,16 @@ H5D_chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src,
bkg = udata.bkg;
done:
- if(sid_buf > 0 && H5I_dec_ref(sid_buf, FALSE) < 0)
+ if(sid_buf > 0 && H5I_dec_ref(sid_buf, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't decrement temporary dataspace ID")
if(tid_src > 0)
- if(H5I_dec_ref(tid_src, FALSE) < 0)
+ if(H5I_dec_ref(tid_src, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
if(tid_dst > 0)
- if(H5I_dec_ref(tid_dst, FALSE) < 0)
+ if(H5I_dec_ref(tid_dst, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
if(tid_mem > 0)
- if(H5I_dec_ref(tid_mem, FALSE) < 0)
+ if(H5I_dec_ref(tid_mem, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
if(buf)
H5MM_xfree(buf);
@@ -4845,8 +4845,10 @@ H5D_chunk_dest(H5F_t *f, hid_t dxpl_id, H5D_t *dset)
if(H5D_chunk_cache_evict(dset, dxpl_id, dxpl_cache, ent, TRUE) < 0)
nerrors++;
} /* end for */
+
+ /* Continue even if there are failures. */
if(nerrors)
- HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
+ HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
/* Release cache structures */
if(rdcc->slot)
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index b5bf217..5fb2f5d 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -558,16 +558,16 @@ H5D_compact_copy(H5F_t *f_src, H5O_storage_compact_t *storage_src, H5F_t *f_dst,
storage_dst->dirty = TRUE;
done:
- if(buf_sid > 0 && H5I_dec_ref(buf_sid, FALSE) < 0)
+ if(buf_sid > 0 && H5I_dec_ref(buf_sid, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't decrement temporary dataspace ID")
if(tid_src > 0)
- if(H5I_dec_ref(tid_src, FALSE) < 0)
+ if(H5I_dec_ref(tid_src, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
if(tid_dst > 0)
- if(H5I_dec_ref(tid_dst, FALSE) < 0)
+ if(H5I_dec_ref(tid_dst, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
if(tid_mem > 0)
- if(H5I_dec_ref(tid_mem, FALSE) < 0)
+ if(H5I_dec_ref(tid_mem, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
if(buf)
buf = H5FL_BLK_FREE(type_conv, buf);
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index b674f44..ded0297 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -1450,16 +1450,16 @@ H5D_contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
} /* end while */
done:
- if(buf_sid > 0 && H5I_dec_ref(buf_sid, FALSE) < 0)
+ if(buf_sid > 0 && H5I_dec_ref(buf_sid, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't decrement temporary dataspace ID")
if(tid_src > 0)
- if(H5I_dec_ref(tid_src, FALSE) < 0)
+ if(H5I_dec_ref(tid_src, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
if(tid_dst > 0)
- if(H5I_dec_ref(tid_dst, FALSE) < 0)
+ if(H5I_dec_ref(tid_dst, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
if(tid_mem > 0)
- if(H5I_dec_ref(tid_mem, FALSE) < 0)
+ if(H5I_dec_ref(tid_mem, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
if(buf)
buf = H5FL_BLK_FREE(type_conv, buf);
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index 1999dda..bff51f6 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -332,9 +332,9 @@ H5D_fill(const void *fill, const H5T_t *fill_type, void *buf,
} /* end else */
done:
- if(src_id != (-1) && H5I_dec_ref(src_id, FALSE) < 0)
+ if(src_id != (-1) && H5I_dec_ref(src_id, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
- if(dst_id != (-1) && H5I_dec_ref(dst_id, FALSE) < 0)
+ if(dst_id != (-1) && H5I_dec_ref(dst_id, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
if(tmp_buf)
tmp_buf = H5FL_BLK_FREE(type_conv, tmp_buf);
@@ -693,7 +693,7 @@ H5D_fill_term(H5D_fill_buf_info_t *fb_info)
/* Free other resources for vlen fill values */
if(fb_info->has_vlen_fill_type) {
if(fb_info->mem_tid > 0)
- H5I_dec_ref(fb_info->mem_tid, FALSE);
+ H5I_dec_ref(fb_info->mem_tid, FALSE, FALSE);
else if(fb_info->mem_type)
H5T_close(fb_info->mem_type);
if(fb_info->bkg_buf)
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 20c02c1..e237362 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -561,7 +561,7 @@ done:
if(ret_value == NULL)
if(new_dset != NULL) {
if(new_dset->dcpl_id != 0)
- (void)H5I_dec_ref(new_dset->dcpl_id, FALSE);
+ (void)H5I_dec_ref(new_dset->dcpl_id, FALSE, FALSE);
new_dset = H5FL_FREE(H5D_shared_t, new_dset);
} /* end if */
@@ -1061,7 +1061,7 @@ done:
if(new_dset->shared->space && H5S_close(new_dset->shared->space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataspace")
if(new_dset->shared->type) {
- if(H5I_dec_ref(new_dset->shared->type_id, FALSE) < 0)
+ if(H5I_dec_ref(new_dset->shared->type_id, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype")
} /* end if */
if(H5F_addr_defined(new_dset->oloc.addr)) {
@@ -1072,7 +1072,7 @@ done:
HDONE_ERROR(H5E_DATASET, H5E_CANTDELETE, NULL, "unable to delete object header")
} /* end if */
} /* end if */
- if(new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id, FALSE) < 0)
+ if(new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list")
new_dset->shared = H5FL_FREE(H5D_shared_t, new_dset->shared);
} /* end if */
@@ -1319,7 +1319,7 @@ done:
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
if(dataset->shared->type) {
if(dataset->shared->type_id > 0) {
- if(H5I_dec_ref(dataset->shared->type_id, FALSE) < 0)
+ if(H5I_dec_ref(dataset->shared->type_id, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
} /* end if */
else {
@@ -1367,9 +1367,9 @@ H5D_close(H5D_t *dataset)
dataset->shared->fo_count--;
if(dataset->shared->fo_count == 0) {
- /* Flush the dataset's information */
+ /* Flush the dataset's information. Continue to close even if it fails. */
if(H5D_flush_real(dataset, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info")
+ 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) {
@@ -1403,9 +1403,10 @@ H5D_close(H5D_t *dataset)
dataset->shared->cache.chunk.single_chunk_info = NULL;
} /* end if */
- /* Flush and destroy chunks in the cache */
+ /* Flush and destroy chunks in the cache. Continue to close even if
+ * it fails. */
if(H5D_chunk_dest(dataset->oloc.file, H5AC_dxpl_id, dataset) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy chunk cache")
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy chunk cache")
break;
case H5D_COMPACT:
@@ -1426,8 +1427,8 @@ 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, FALSE) < 0 || H5S_close(dataset->shared->space) < 0 ||
- H5I_dec_ref(dataset->shared->dcpl_id, FALSE) < 0);
+ free_failed = (unsigned)(H5I_dec_ref(dataset->shared->type_id, FALSE, FALSE) < 0 || H5S_close(dataset->shared->space) < 0 ||
+ H5I_dec_ref(dataset->shared->dcpl_id, FALSE, FALSE) < 0);
/* Remove the dataset from the list of opened objects in the file */
if(H5FO_top_decr(dataset->oloc.file, dataset->oloc.addr) < 0)
diff --git a/src/H5E.c b/src/H5E.c
index b90caff..33ff525 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -505,7 +505,7 @@ H5Eunregister_class(hid_t class_id)
* Decrement the counter on the dataset. It will be freed if the count
* reaches zero.
*/
- if(H5I_dec_ref(class_id, TRUE) < 0)
+ if(H5I_dec_ref(class_id, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error class")
done:
@@ -684,7 +684,7 @@ H5Eclose_msg(hid_t err_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an error class")
/* Decrement the counter. It will be freed if the count reaches zero. */
- if(H5I_dec_ref(err_id, TRUE) < 0)
+ if(H5I_dec_ref(err_id, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error message")
done:
@@ -1036,7 +1036,7 @@ H5Eset_current_stack(hid_t err_stack)
* Decrement the counter on the error stack. It will be freed if the count
* reaches zero.
*/
- if(H5I_dec_ref(err_stack, TRUE) < 0)
+ if(H5I_dec_ref(err_stack, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error stack")
} /* end if */
@@ -1138,7 +1138,7 @@ H5Eclose_stack(hid_t stack_id)
* Decrement the counter on the error stack. It will be freed if the count
* reaches zero.
*/
- if(H5I_dec_ref(stack_id, TRUE)<0)
+ if(H5I_dec_ref(stack_id, TRUE, FALSE)<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error stack")
} /* end if */
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 0bf9083..d02d31b 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -892,11 +892,11 @@ H5E_clear_entries(H5E_t *estack, size_t nentries)
/* Decrement the IDs to indicate that they are no longer used by this stack */
/* (In reverse order that they were incremented, so that reference counts work well) */
- if(H5I_dec_ref(error->min_num, FALSE) < 0)
+ if(H5I_dec_ref(error->min_num, FALSE, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error message")
- if(H5I_dec_ref(error->maj_num, FALSE) < 0)
+ if(H5I_dec_ref(error->maj_num, FALSE, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error message")
- if(H5I_dec_ref(error->cls_id, FALSE) < 0)
+ if(H5I_dec_ref(error->cls_id, FALSE, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error class")
/* Release strings */
diff --git a/src/H5F.c b/src/H5F.c
index f15a0cd..29e36d0 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1063,7 +1063,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush)
if(H5I_GENPROP_LST != H5I_get_type(f->shared->fcpl_id))
/* Push error, but keep going*/
HDONE_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property list")
- if(H5I_dec_ref(f->shared->fcpl_id, FALSE) < 0)
+ if(H5I_dec_ref(f->shared->fcpl_id, FALSE, FALSE) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close property list")
@@ -1874,7 +1874,7 @@ H5F_try_close(H5F_t *f)
while((obj_count = H5F_get_obj_ids(f, H5F_OBJ_LOCAL|H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_ATTR, (int)(sizeof(objs)/sizeof(objs[0])), objs, FALSE)) != 0) {
/* Try to close all the open objects in this file */
for(u = 0; u < obj_count; u++)
- if(H5I_dec_ref(objs[u], FALSE) < 0)
+ if(H5I_dec_ref(objs[u], FALSE, FALSE) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't close object")
} /* end while */
@@ -1886,7 +1886,7 @@ H5F_try_close(H5F_t *f)
while((obj_count = H5F_get_obj_ids(f, H5F_OBJ_LOCAL|H5F_OBJ_DATATYPE, (int)(sizeof(objs)/sizeof(objs[0])), objs, FALSE)) != 0) {
/* Try to close all the open objects in this file */
for(u = 0; u < obj_count; u++)
- if(H5I_dec_ref(objs[u], FALSE) < 0)
+ if(H5I_dec_ref(objs[u], FALSE, FALSE) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't close object")
} /* end while */
} /* end if */
@@ -1973,7 +1973,7 @@ H5Fclose(hid_t file_id)
* Decrement reference count on atom. When it reaches zero the file will
* be closed.
*/
- if(H5I_dec_ref(file_id, TRUE) < 0)
+ if(H5I_dec_ref(file_id, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed")
done:
diff --git a/src/H5FD.c b/src/H5FD.c
index 99f2e3c..610e011 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -413,7 +413,7 @@ H5FDunregister(hid_t driver_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver")
/* The H5FD_class_t struct will be freed by this function */
- if(H5I_dec_ref(driver_id, TRUE) < 0)
+ if(H5I_dec_ref(driver_id, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to unregister file driver")
done:
@@ -660,7 +660,7 @@ H5FD_pl_close(hid_t driver_id, herr_t (*free_func)(void *), void *pl)
H5MM_xfree(pl);
/* Decrement reference count for driver */
- if(H5I_dec_ref(driver_id, FALSE) < 0)
+ if(H5I_dec_ref(driver_id, FALSE, FALSE) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't decrement reference count for driver")
done:
@@ -1187,7 +1187,7 @@ H5FD_close(H5FD_t *file)
/* Prepare to close file by clearing all public fields */
driver = file->cls;
- if(H5I_dec_ref(file->driver_id, FALSE) < 0)
+ if(H5I_dec_ref(file->driver_id, FALSE, FALSE) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID")
/*
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 67bb107..ae66578 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -472,7 +472,7 @@ H5FD_family_fapl_free(void *_fa)
FUNC_ENTER_NOAPI(H5FD_family_fapl_free, FAIL)
- if(H5I_dec_ref(fa->memb_fapl_id, FALSE)<0)
+ if(H5I_dec_ref(fa->memb_fapl_id, FALSE, FALSE)<0)
HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID")
H5MM_xfree(fa);
@@ -558,7 +558,7 @@ H5FD_family_dxpl_free(void *_dx)
FUNC_ENTER_NOAPI(H5FD_family_dxpl_free, FAIL)
- if(H5I_dec_ref(dx->memb_dxpl_id, FALSE)<0)
+ if(H5I_dec_ref(dx->memb_dxpl_id, FALSE, FALSE)<0)
HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID")
H5MM_xfree(dx);
@@ -870,7 +870,7 @@ done:
if (file->memb)
H5MM_xfree(file->memb);
- if(H5I_dec_ref(file->memb_fapl_id, FALSE)<0)
+ if(H5I_dec_ref(file->memb_fapl_id, FALSE, FALSE)<0)
HDONE_ERROR(H5E_VFL, H5E_CANTDEC, NULL, "can't close driver ID")
if (file->name)
H5MM_xfree(file->name);
@@ -921,7 +921,7 @@ H5FD_family_close(H5FD_t *_file)
HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close member files")
/* Clean up other stuff */
- if(H5I_dec_ref(file->memb_fapl_id, FALSE) < 0)
+ if(H5I_dec_ref(file->memb_fapl_id, FALSE, FALSE) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID")
H5MM_xfree(file->memb);
diff --git a/src/H5G.c b/src/H5G.c
index 1e8669b..295ed48 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -504,7 +504,7 @@ H5Gget_create_plist(hid_t group_id)
done:
if(ret_value < 0) {
if(new_gcpl_id > 0)
- (void)H5I_dec_ref(new_gcpl_id, TRUE);
+ (void)H5I_dec_ref(new_gcpl_id, TRUE, FALSE);
} /* end if */
FUNC_LEAVE_API(ret_value)
@@ -714,7 +714,7 @@ H5Gclose(hid_t group_id)
* Decrement the counter on the group atom. It will be freed if the count
* reaches zero.
*/
- if(H5I_dec_ref(group_id, TRUE) < 0)
+ if(H5I_dec_ref(group_id, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group")
done:
@@ -1536,7 +1536,7 @@ H5G_iterate(hid_t loc_id, const char *group_name,
done:
/* Release the group opened */
if(gid > 0) {
- if(H5I_dec_ref(gid, TRUE) < 0)
+ if(H5I_dec_ref(gid, TRUE, FALSE) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group")
} /* end if */
else if(grp && H5G_close(grp) < 0)
@@ -1869,7 +1869,7 @@ done:
/* Release the group opened */
if(gid > 0) {
- if(H5I_dec_ref(gid, TRUE) < 0)
+ if(H5I_dec_ref(gid, TRUE, FALSE) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group")
} /* end if */
else if(grp && H5G_close(grp) < 0)
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index 6629934..4f5b947 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -253,7 +253,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
done:
if(tmp_gcpl > 0 && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT)
- if(H5I_dec_ref(tmp_gcpl, FALSE) < 0)
+ if(H5I_dec_ref(tmp_gcpl, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release property list")
if(ret_value < 0)
diff --git a/src/H5Gname.c b/src/H5Gname.c
index 96b2e3a..02cf571 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -461,12 +461,12 @@ H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size,
/* Search for name of object */
if((len = H5G_get_name_by_addr(file, lapl_id, dxpl_id, loc->oloc, name, size)) < 0) {
- H5I_dec_ref(file, FALSE);
+ H5I_dec_ref(file, FALSE, FALSE);
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine name")
} /* end if */
/* Close file ID used for search */
- if(H5I_dec_ref(file, FALSE) < 0)
+ if(H5I_dec_ref(file, FALSE, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCLOSEFILE, FAIL, "can't determine name")
/* Indicate that the name is _not_ cached, if requested */
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index 742e2bc..6eef7eb 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -270,22 +270,22 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk,
/* We have a copy of the location and we're holding the file open.
* Close the open ID the user passed back.
*/
- if(H5I_dec_ref(cb_return, FALSE) < 0)
+ if(H5I_dec_ref(cb_return, FALSE, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback")
cb_return = (-1);
done:
/* Close location given to callback. */
if(cur_grp > 0)
- if(H5I_dec_ref(cur_grp, FALSE) < 0)
+ if(H5I_dec_ref(cur_grp, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close atom for current location")
if(ret_value < 0 && cb_return > 0)
- if(H5I_dec_ref(cb_return, FALSE) < 0)
+ if(H5I_dec_ref(cb_return, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback")
/* Close the LAPL, if we copied one */
- if(lapl_id > 0 && H5I_dec_ref(lapl_id, FALSE) < 0)
+ if(lapl_id > 0 && H5I_dec_ref(lapl_id, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close copied link access property list")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5I.c b/src/H5I.c
index be3c9d6..9b67b14 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -1330,7 +1330,7 @@ H5Idec_ref(hid_t id)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID")
/* Do actual decrement operation */
- if((ret_value = H5I_dec_ref(id, TRUE)) < 0)
+ if((ret_value = H5I_dec_ref(id, TRUE, FALSE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, FAIL, "can't decrement ID ref count")
done:
@@ -1369,20 +1369,25 @@ done:
* removed from the type and its reference count is not decremented.
* The type number is now passed to the free method.
*
- * Raymond, 11 Dec 2001
+ * Raymond Lu, 11 Dec 2001
* If the freeing function fails, return failure instead of reference
* count 1. This feature is needed by file close with H5F_CLOSE_SEMI
* value.
*
- * Neil Fortner, 7 Aug 2008
- * Added app_ref parameter and support for the app_count field, to
- * distiguish between reference count from the library and from the
- * application.
+ * Neil Fortner, 7 Aug 2008
+ * Added app_ref parameter and support for the app_count field, to
+ * distiguish between reference count from the library and from the
+ * application.
+ *
+ * Raymond Lu, 7 September 2010
+ * I added the 3rd parameter to indicate whether H5Dclose is calling
+ * this function. All other calls should pass in FALSE. Please see
+ * the comments in the code below.
*
*-------------------------------------------------------------------------
*/
int
-H5I_dec_ref(hid_t id, hbool_t app_ref)
+H5I_dec_ref(hid_t id, hbool_t app_ref, hbool_t dset_close)
{
H5I_type_t type; /*type the object is in*/
H5I_id_type_t *type_ptr; /*ptr to the type */
@@ -1415,6 +1420,11 @@ H5I_dec_ref(hid_t id, hbool_t app_ref)
* reference count without calling the free method.
*
* Beware: the free method may call other H5I functions.
+ *
+ * If a dataset is closing, we remove the ID even though the freeing
+ * might fail. This can happen when a mandatory filter fails to write
+ * when the dataset is closed and the chunk cache is flushed to the
+ * file. We have a close the dataset anyway. (SLU - 2010/9/7)
*/
if(1 == id_ptr->count) {
/* (Casting away const OK -QAK) */
@@ -1422,8 +1432,11 @@ H5I_dec_ref(hid_t id, hbool_t app_ref)
H5I_remove(id);
ret_value = 0;
} /* end if */
- else
+ else {
+ if(dset_close)
+ H5I_remove(id);
ret_value = FAIL;
+ }
} /* end if */
else {
--(id_ptr->count);
diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h
index ef83908..3321ada 100644
--- a/src/H5Iprivate.h
+++ b/src/H5Iprivate.h
@@ -65,7 +65,7 @@ H5_DLL void *H5I_remove_verify(hid_t id, H5I_type_t id_type);
H5_DLL void *H5I_search(H5I_type_t type, H5I_search_func_t func, void *key, hbool_t app_ref);
H5_DLL int H5I_get_ref(hid_t id, hbool_t app_ref);
H5_DLL int H5I_inc_ref(hid_t id, hbool_t app_ref);
-H5_DLL int H5I_dec_ref(hid_t id, hbool_t app_ref);
+H5_DLL int H5I_dec_ref(hid_t id, hbool_t app_ref, hbool_t dset_close);
H5_DLL int H5I_inc_type_ref(H5I_type_t type);
H5_DLL herr_t H5I_dec_type_ref(H5I_type_t type);
H5_DLL int H5I_get_type_ref(H5I_type_t type);
diff --git a/src/H5L.c b/src/H5L.c
index 9b29263..9f983de 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -1762,7 +1762,7 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED
done:
/* Close the location given to the user callback if it was created */
if(grp_id >= 0) {
- if(H5I_dec_ref(grp_id, TRUE) < 0)
+ if(H5I_dec_ref(grp_id, TRUE, FALSE) < 0)
HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback")
} /* end if */
else if(grp != NULL) {
@@ -2464,7 +2464,7 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
done:
/* Close the location given to the user callback if it was created */
if(grp_id >= 0) {
- if(H5I_dec_ref(grp_id, TRUE) < 0)
+ if(H5I_dec_ref(grp_id, TRUE, FALSE) < 0)
HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback")
} /* end if */
else if(grp != NULL) {
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index d98a843..10091d0 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -453,7 +453,7 @@ H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group,
done:
/* Release resources */
- if(fapl_id > 0 && H5I_dec_ref(fapl_id, FALSE) < 0)
+ if(fapl_id > 0 && H5I_dec_ref(fapl_id, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list")
if(ext_file && H5F_try_close(ext_file) < 0)
HDONE_ERROR(H5E_LINK, H5E_CANTCLOSEFILE, FAIL, "problem closing external file")
@@ -465,7 +465,7 @@ done:
if(ret_value < 0) {
/* Close object if it's open and something failed */
- if(ext_obj >= 0 && H5I_dec_ref(ext_obj, FALSE) < 0)
+ if(ext_obj >= 0 && H5I_dec_ref(ext_obj, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom for external object")
} /* end if */
diff --git a/src/H5O.c b/src/H5O.c
index 3b4d70a..0a1f16e 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1058,7 +1058,7 @@ H5Oclose(hid_t object_id)
case H5I_DATASET:
if(H5I_object(object_id) == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object")
- if(H5I_dec_ref(object_id, TRUE) < 0)
+ if(H5I_dec_ref(object_id, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object")
break;
@@ -3337,7 +3337,7 @@ H5O_visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
done:
if(obj_id > 0) {
- if(H5I_dec_ref(obj_id, TRUE) < 0)
+ if(H5I_dec_ref(obj_id, TRUE, FALSE) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object")
} /* end if */
else if(loc_found && H5G_loc_free(&obj_loc) < 0)
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index ebe1eb5..8bde5ae 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -539,30 +539,30 @@ H5O_fill_copy(const void *_src, void *_dst)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy/register datatype")
src_id = H5I_register(H5I_DATATYPE, H5T_copy(src->type, H5T_COPY_ALL), FALSE);
if(src_id < 0) {
- H5I_dec_ref(dst_id, FALSE);
+ H5I_dec_ref(dst_id, FALSE, FALSE);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy/register datatype")
} /* end if */
/* Allocate a background buffer */
bkg_size = MAX(H5T_get_size(dst->type), H5T_get_size(src->type));
if(H5T_path_bkg(tpath) && NULL == (bkg_buf = H5FL_BLK_CALLOC(type_conv, bkg_size))) {
- H5I_dec_ref(src_id, FALSE);
- H5I_dec_ref(dst_id, FALSE);
+ H5I_dec_ref(src_id, FALSE, FALSE);
+ H5I_dec_ref(dst_id, FALSE, FALSE);
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
} /* end if */
/* Convert fill value */
if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, dst->buf, bkg_buf, H5AC_ind_dxpl_id) < 0) {
- H5I_dec_ref(src_id, FALSE);
- H5I_dec_ref(dst_id, FALSE);
+ H5I_dec_ref(src_id, FALSE, FALSE);
+ H5I_dec_ref(dst_id, FALSE, FALSE);
if(bkg_buf)
bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf);
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, NULL, "datatype conversion failed")
} /* end if */
/* Release the background buffer */
- H5I_dec_ref(src_id, FALSE);
- H5I_dec_ref(dst_id, FALSE);
+ H5I_dec_ref(src_id, FALSE, FALSE);
+ H5I_dec_ref(dst_id, FALSE, FALSE);
if(bkg_buf)
bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf);
} /* end if */
@@ -726,7 +726,7 @@ H5O_fill_reset_dyn(H5O_fill_t *fill)
done:
if(fill_type_id > 0)
- H5I_dec_ref(fill_type_id, FALSE);
+ H5I_dec_ref(fill_type_id, FALSE, FALSE);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_fill_reset_dyn() */
@@ -979,9 +979,9 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed, hid_
done:
if(src_id >= 0)
- H5I_dec_ref(src_id, FALSE);
+ H5I_dec_ref(src_id, FALSE, FALSE);
if(dst_id >= 0)
- H5I_dec_ref(dst_id, FALSE);
+ H5I_dec_ref(dst_id, FALSE, FALSE);
if(buf != fill->buf)
H5MM_xfree(buf);
if(bkg)
diff --git a/src/H5Olink.c b/src/H5Olink.c
index 0438bb7..b8a5e60 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -641,12 +641,12 @@ H5O_link_delete(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh, void *_mesg)
/* Call user-defined link's 'delete' callback */
if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) {
- H5I_dec_ref(file_id, FALSE);
+ H5I_dec_ref(file_id, FALSE, FALSE);
HGOTO_ERROR(H5E_OHDR, H5E_CALLBACK, FAIL, "link deletion callback returned failure")
} /* end if */
/* Release the file ID */
- if(H5I_dec_ref(file_id, FALSE) < 0)
+ if(H5I_dec_ref(file_id, FALSE, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file")
} /* end if */
} /* end if */
diff --git a/src/H5P.c b/src/H5P.c
index 2e69461..3cfd272 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -1392,7 +1392,7 @@ H5Pclose(hid_t plist_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
/* Close the property list */
- if(H5I_dec_ref(plist_id, TRUE) < 0)
+ if(H5I_dec_ref(plist_id, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close");
done:
@@ -1525,7 +1525,7 @@ H5Pclose_class(hid_t cls_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class");
/* Close the property list class */
- if(H5I_dec_ref(cls_id, TRUE) < 0)
+ if(H5I_dec_ref(cls_id, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close");
done:
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 6ceed64..4af4e83 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -1579,9 +1579,9 @@ done:
if(bkg != value)
H5MM_xfree(bkg);
if(src_id >= 0)
- H5I_dec_ref(src_id, FALSE);
+ H5I_dec_ref(src_id, FALSE, FALSE);
if(dst_id >= 0)
- H5I_dec_ref(dst_id, FALSE);
+ H5I_dec_ref(dst_id, FALSE, FALSE);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_get_fill_value() */
diff --git a/src/H5Plapl.c b/src/H5Plapl.c
index 22cef28..f41c12e 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -208,7 +208,7 @@ H5P_lacc_elink_fapl_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UN
l_fapl_id = (*(const hid_t *)value);
- if((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id, FALSE) < 0))
+ if((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id, FALSE, FALSE) < 0))
HGOTO_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list")
done:
@@ -282,7 +282,7 @@ H5P_lacc_elink_fapl_close(const char UNUSED *name, size_t UNUSED size, void *val
HDassert(value);
l_fapl_id = (*(const hid_t *)value);
- if((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id, FALSE) < 0))
+ if((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id, FALSE, FALSE) < 0))
HGOTO_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list")
done:
@@ -589,7 +589,7 @@ H5Pset_elink_fapl(hid_t lapl_id, hid_t fapl_id)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl")
/* Close the current file access property list if set */
- if((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id, FALSE) < 0))
+ if((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id, FALSE, FALSE) < 0))
HGOTO_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list")
if(NULL == (fapl_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
diff --git a/src/H5R.c b/src/H5R.c
index ada2269..c680600 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -892,7 +892,7 @@ H5R_get_name(H5F_t *f, hid_t lapl_id, hid_t dxpl_id, hid_t id, H5R_type_t ref_ty
done:
/* Close file ID used for search */
if(file_id > 0)
- if(H5I_dec_ref(file_id, FALSE) < 0)
+ if(H5I_dec_ref(file_id, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_REFERENCE, H5E_CANTCLOSEFILE, FAIL, "can't determine name")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5S.c b/src/H5S.c
index b0a0a5e..8d6ae50 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -365,7 +365,7 @@ H5Sclose(hid_t space_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
/* When the reference count reaches zero the resources are freed */
- if (H5I_dec_ref(space_id, TRUE) < 0)
+ if (H5I_dec_ref(space_id, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id")
done:
diff --git a/src/H5T.c b/src/H5T.c
index f1b9f1b..2057a2a 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -1723,7 +1723,7 @@ H5Tclose(hid_t type_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "immutable datatype")
/* When the reference count reaches zero the resources are freed */
- if(H5I_dec_ref(type_id, TRUE) < 0)
+ if(H5I_dec_ref(type_id, TRUE, FALSE) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id")
done:
@@ -2348,8 +2348,8 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
cdata.command = H5T_CONV_INIT;
if ((func)(tmp_sid, tmp_did, &cdata, (size_t)0, (size_t)0, (size_t)0,
NULL, NULL, dxpl_id)<0) {
- H5I_dec_ref(tmp_sid, FALSE);
- H5I_dec_ref(tmp_did, FALSE);
+ H5I_dec_ref(tmp_sid, FALSE, FALSE);
+ H5I_dec_ref(tmp_did, FALSE, FALSE);
tmp_sid = tmp_did = -1;
H5E_clear_stack(NULL);
continue;
@@ -2389,8 +2389,8 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
old_path = H5FL_FREE(H5T_path_t, old_path);
/* Release temporary atoms */
- H5I_dec_ref(tmp_sid, FALSE);
- H5I_dec_ref(tmp_did, FALSE);
+ H5I_dec_ref(tmp_sid, FALSE, FALSE);
+ H5I_dec_ref(tmp_did, FALSE, FALSE);
tmp_sid = tmp_did = -1;
/* We don't care about any failures during the freeing process */
@@ -2408,9 +2408,9 @@ done:
new_path = H5FL_FREE(H5T_path_t, new_path);
} /* end if */
if(tmp_sid >= 0)
- H5I_dec_ref(tmp_sid, FALSE);
+ H5I_dec_ref(tmp_sid, FALSE, FALSE);
if(tmp_did >= 0)
- H5I_dec_ref(tmp_did, FALSE);
+ H5I_dec_ref(tmp_did, FALSE, FALSE);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value);
@@ -4409,9 +4409,9 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
if((func)(src_id, dst_id, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to initialize conversion function")
if(src_id >= 0)
- H5I_dec_ref(src_id, FALSE);
+ H5I_dec_ref(src_id, FALSE, FALSE);
if(dst_id >= 0)
- H5I_dec_ref(dst_id, FALSE);
+ H5I_dec_ref(dst_id, FALSE, FALSE);
src_id = dst_id = -1;
path->func = func;
path->is_hard = TRUE;
@@ -4441,8 +4441,8 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
path->func = H5T_g.soft[i].func;
path->is_hard = FALSE;
} /* end else */
- H5I_dec_ref(src_id, FALSE);
- H5I_dec_ref(dst_id, FALSE);
+ H5I_dec_ref(src_id, FALSE, FALSE);
+ H5I_dec_ref(dst_id, FALSE, FALSE);
src_id = dst_id = -1;
} /* end for */
if(!path->func)
@@ -4529,9 +4529,9 @@ done:
path = H5FL_FREE(H5T_path_t, path);
} /* end if */
if(src_id >= 0)
- H5I_dec_ref(src_id, FALSE);
+ H5I_dec_ref(src_id, FALSE, FALSE);
if(dst_id >= 0)
- H5I_dec_ref(dst_id, FALSE);
+ H5I_dec_ref(dst_id, FALSE, FALSE);
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5T_path_find() */
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index c7f0259..79708de 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -664,7 +664,7 @@ H5Tget_create_plist(hid_t dtype_id)
done:
if(ret_value < 0)
if(new_tcpl_id > 0)
- (void)H5I_dec_ref(new_tcpl_id, TRUE);
+ (void)H5I_dec_ref(new_tcpl_id, TRUE, FALSE);
FUNC_LEAVE_API(ret_value)
} /* end H5Tget_create_plist() */
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 6069577..d66619d 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -1783,9 +1783,9 @@ H5T_conv_struct_free(H5T_conv_struct_t *priv)
for (i=0; i<priv->src_nmembs; i++)
if (src2dst[i] >= 0) {
- status = H5I_dec_ref(src_memb_id[i], FALSE);
+ status = H5I_dec_ref(src_memb_id[i], FALSE, FALSE);
HDassert(status >= 0);
- status = H5I_dec_ref(dst_memb_id[src2dst[i]], FALSE);
+ status = H5I_dec_ref(dst_memb_id[src2dst[i]], FALSE, FALSE);
HDassert(status >= 0);
}
@@ -3173,9 +3173,9 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/* Release the temporary datatype IDs used */
if(tsrc_id >= 0)
- H5I_dec_ref(tsrc_id, FALSE);
+ H5I_dec_ref(tsrc_id, FALSE, FALSE);
if(tdst_id >= 0)
- H5I_dec_ref(tdst_id, FALSE);
+ H5I_dec_ref(tdst_id, FALSE, FALSE);
break;
default: /* Some other command we don't know about yet.*/
@@ -3325,9 +3325,9 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/* Release the temporary datatype IDs used */
if(tsrc_id >= 0)
- H5I_dec_ref(tsrc_id, FALSE);
+ H5I_dec_ref(tsrc_id, FALSE, FALSE);
if(tdst_id >= 0)
- H5I_dec_ref(tdst_id, FALSE);
+ H5I_dec_ref(tdst_id, FALSE, FALSE);
break;
default: /* Some other command we don't know about yet.*/
diff --git a/src/H5Z.c b/src/H5Z.c
index ee46941..84c89f3 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -637,7 +637,7 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type
} /* end if */
done:
- if(space_id > 0 && H5I_dec_ref(space_id, FALSE) < 0)
+ if(space_id > 0 && H5I_dec_ref(space_id, FALSE, FALSE) < 0)
HDONE_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace")
FUNC_LEAVE_NOAPI(ret_value)