summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST1
-rwxr-xr-xconfigure2
-rw-r--r--release_docs/RELEASE.txt3
-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
-rw-r--r--test/Makefile.am4
-rw-r--r--test/Makefile.in70
-rw-r--r--test/filter_fail.c382
-rw-r--r--test/tid.c4
41 files changed, 589 insertions, 175 deletions
diff --git a/MANIFEST b/MANIFEST
index c7ecc52..5c853d5 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -808,6 +808,7 @@
./test/freespace.c
./test/fill_old.h5
./test/fillval.c
+./test/filter_fail.c
./test/fixed_idx.h5
./test/flush1.c
./test/flush2.c
diff --git a/configure b/configure
index 64ec9e0..fcf2587 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in Id: configure.in 19186 2010-08-06 19:37:50Z acheng .
+# From configure.in Id: configure.in 19314 2010-08-26 22:02:15Z koziol .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.65 for HDF5 1.8.5-snap5.
#
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index c888ed6..f586b3a 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -117,6 +117,9 @@ Bug Fixes since HDF5-1.8.5
Library
-------
+ - When a 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. (SLU - 2010/9/8)
- H5Eset_current_stack now also closes the error stack to be set as the
default. This is to avoid a potential problem (Bug 1799).
(SLU - 2010/9/7)
diff --git a/src/H5A.c b/src/H5A.c
index 720c3f9..4286d3d 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 6349788..64c2318 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 b57896e..2061251 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 867d7fb..0e68e28 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 298068f..56e2b1e 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 */
@@ -4628,16 +4628,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);
@@ -4839,8 +4839,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 538ff80..446d040 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 0e0da0a..8f89e99 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 1d9b4e1..6c466a9 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 1b97b2e..2568a9b 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1057,7 +1057,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")
@@ -1868,7 +1868,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 */
@@ -1880,7 +1880,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 */
@@ -1967,7 +1967,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 e9e124f..460257a 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 8a62d5e..add28ae 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 8e5fc70..4d19a06 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 1ecb9e6..01dab4e 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -1403,7 +1403,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:
@@ -1442,20 +1442,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 */
@@ -1488,6 +1493,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) */
@@ -1495,8 +1505,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 c18cd0a..520b163 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 c385bc6..9236980 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1057,7 +1057,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;
@@ -3330,7 +3330,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)
diff --git a/test/Makefile.am b/test/Makefile.am
index cb5cd90..d00f11a 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -38,8 +38,8 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT)
# other current library code tests.
TEST_PROG=testhdf5 lheap ohdr stab gheap cache cache_api \
pool hyperslab istore bittests dt_arith \
- dtypes dsets cmpd_dset extend external objcopy links unlink big mtime \
- fillval mount flush1 flush2 app_ref enum \
+ dtypes dsets cmpd_dset filter_fail extend external objcopy links unlink \
+ big mtime fillval mount flush1 flush2 app_ref enum \
set_extent ttsafe \
getname vfd ntypes dangle dtransform reserved cross_read \
freespace mf btree2 fheap
diff --git a/test/Makefile.in b/test/Makefile.in
index 48f3d39..ab1fe70 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -79,15 +79,15 @@ am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \
stab$(EXEEXT) gheap$(EXEEXT) cache$(EXEEXT) cache_api$(EXEEXT) \
pool$(EXEEXT) hyperslab$(EXEEXT) istore$(EXEEXT) \
bittests$(EXEEXT) dt_arith$(EXEEXT) dtypes$(EXEEXT) \
- dsets$(EXEEXT) cmpd_dset$(EXEEXT) extend$(EXEEXT) \
- external$(EXEEXT) objcopy$(EXEEXT) links$(EXEEXT) \
- unlink$(EXEEXT) big$(EXEEXT) mtime$(EXEEXT) fillval$(EXEEXT) \
- mount$(EXEEXT) flush1$(EXEEXT) flush2$(EXEEXT) \
- app_ref$(EXEEXT) enum$(EXEEXT) set_extent$(EXEEXT) \
- ttsafe$(EXEEXT) getname$(EXEEXT) vfd$(EXEEXT) ntypes$(EXEEXT) \
- dangle$(EXEEXT) dtransform$(EXEEXT) reserved$(EXEEXT) \
- cross_read$(EXEEXT) freespace$(EXEEXT) mf$(EXEEXT) \
- btree2$(EXEEXT) fheap$(EXEEXT)
+ dsets$(EXEEXT) cmpd_dset$(EXEEXT) filter_fail$(EXEEXT) \
+ extend$(EXEEXT) external$(EXEEXT) objcopy$(EXEEXT) \
+ links$(EXEEXT) unlink$(EXEEXT) big$(EXEEXT) mtime$(EXEEXT) \
+ fillval$(EXEEXT) mount$(EXEEXT) flush1$(EXEEXT) \
+ flush2$(EXEEXT) app_ref$(EXEEXT) enum$(EXEEXT) \
+ set_extent$(EXEEXT) ttsafe$(EXEEXT) getname$(EXEEXT) \
+ vfd$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \
+ dtransform$(EXEEXT) reserved$(EXEEXT) cross_read$(EXEEXT) \
+ freespace$(EXEEXT) mf$(EXEEXT) btree2$(EXEEXT) fheap$(EXEEXT)
am__EXEEXT_2 = gen_bad_ohdr$(EXEEXT) gen_bogus$(EXEEXT) \
gen_cross$(EXEEXT) gen_deflate$(EXEEXT) gen_filters$(EXEEXT) \
gen_idx$(EXEEXT) gen_new_array$(EXEEXT) gen_new_fill$(EXEEXT) \
@@ -176,6 +176,10 @@ fillval_SOURCES = fillval.c
fillval_OBJECTS = fillval.$(OBJEXT)
fillval_LDADD = $(LDADD)
fillval_DEPENDENCIES = libh5test.la $(LIBHDF5)
+filter_fail_SOURCES = filter_fail.c
+filter_fail_OBJECTS = filter_fail.$(OBJEXT)
+filter_fail_LDADD = $(LDADD)
+filter_fail_DEPENDENCIES = libh5test.la $(LIBHDF5)
flush1_SOURCES = flush1.c
flush1_OBJECTS = flush1.$(OBJEXT)
flush1_LDADD = $(LDADD)
@@ -366,29 +370,29 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
SOURCES = $(libh5test_la_SOURCES) app_ref.c big.c bittests.c btree2.c \
cache.c cache_api.c cmpd_dset.c cross_read.c dangle.c dsets.c \
dt_arith.c dtransform.c dtypes.c enum.c err_compat.c \
- error_test.c extend.c external.c fheap.c fillval.c flush1.c \
- flush2.c freespace.c gen_bad_ohdr.c gen_bogus.c gen_cross.c \
- gen_deflate.c gen_filters.c gen_idx.c gen_new_array.c \
- gen_new_fill.c gen_new_group.c gen_new_mtime.c gen_new_super.c \
- gen_noencoder.c gen_nullspace.c gen_sizes_lheap.c \
- gen_udlinks.c getname.c gheap.c hyperslab.c istore.c lheap.c \
- links.c mf.c mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c \
- reserved.c set_extent.c space_overflow.c stab.c \
- tcheck_version.c $(testhdf5_SOURCES) testmeta.c \
- $(ttsafe_SOURCES) unlink.c vfd.c
+ error_test.c extend.c external.c fheap.c fillval.c \
+ filter_fail.c flush1.c flush2.c freespace.c gen_bad_ohdr.c \
+ gen_bogus.c gen_cross.c gen_deflate.c gen_filters.c gen_idx.c \
+ gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c \
+ gen_new_super.c gen_noencoder.c gen_nullspace.c \
+ gen_sizes_lheap.c gen_udlinks.c getname.c gheap.c hyperslab.c \
+ istore.c lheap.c links.c mf.c mount.c mtime.c ntypes.c \
+ objcopy.c ohdr.c pool.c reserved.c set_extent.c \
+ space_overflow.c stab.c tcheck_version.c $(testhdf5_SOURCES) \
+ testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c
DIST_SOURCES = $(libh5test_la_SOURCES) app_ref.c big.c bittests.c \
btree2.c cache.c cache_api.c cmpd_dset.c cross_read.c dangle.c \
dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c \
- error_test.c extend.c external.c fheap.c fillval.c flush1.c \
- flush2.c freespace.c gen_bad_ohdr.c gen_bogus.c gen_cross.c \
- gen_deflate.c gen_filters.c gen_idx.c gen_new_array.c \
- gen_new_fill.c gen_new_group.c gen_new_mtime.c gen_new_super.c \
- gen_noencoder.c gen_nullspace.c gen_sizes_lheap.c \
- gen_udlinks.c getname.c gheap.c hyperslab.c istore.c lheap.c \
- links.c mf.c mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c \
- reserved.c set_extent.c space_overflow.c stab.c \
- tcheck_version.c $(testhdf5_SOURCES) testmeta.c \
- $(ttsafe_SOURCES) unlink.c vfd.c
+ error_test.c extend.c external.c fheap.c fillval.c \
+ filter_fail.c flush1.c flush2.c freespace.c gen_bad_ohdr.c \
+ gen_bogus.c gen_cross.c gen_deflate.c gen_filters.c gen_idx.c \
+ gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c \
+ gen_new_super.c gen_noencoder.c gen_nullspace.c \
+ gen_sizes_lheap.c gen_udlinks.c getname.c gheap.c hyperslab.c \
+ istore.c lheap.c links.c mf.c mount.c mtime.c ntypes.c \
+ objcopy.c ohdr.c pool.c reserved.c set_extent.c \
+ space_overflow.c stab.c tcheck_version.c $(testhdf5_SOURCES) \
+ testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c
ETAGS = etags
CTAGS = ctags
am__tty_colors = \
@@ -698,8 +702,8 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT)
# other current library code tests.
TEST_PROG = testhdf5 lheap ohdr stab gheap cache cache_api \
pool hyperslab istore bittests dt_arith \
- dtypes dsets cmpd_dset extend external objcopy links unlink big mtime \
- fillval mount flush1 flush2 app_ref enum \
+ dtypes dsets cmpd_dset filter_fail extend external objcopy links unlink \
+ big mtime fillval mount flush1 flush2 app_ref enum \
set_extent ttsafe \
getname vfd ntypes dangle dtransform reserved cross_read \
freespace mf btree2 fheap
@@ -887,6 +891,9 @@ fheap$(EXEEXT): $(fheap_OBJECTS) $(fheap_DEPENDENCIES)
fillval$(EXEEXT): $(fillval_OBJECTS) $(fillval_DEPENDENCIES)
@rm -f fillval$(EXEEXT)
$(LINK) $(fillval_OBJECTS) $(fillval_LDADD) $(LIBS)
+filter_fail$(EXEEXT): $(filter_fail_OBJECTS) $(filter_fail_DEPENDENCIES)
+ @rm -f filter_fail$(EXEEXT)
+ $(LINK) $(filter_fail_OBJECTS) $(filter_fail_LDADD) $(LIBS)
flush1$(EXEEXT): $(flush1_OBJECTS) $(flush1_DEPENDENCIES)
@rm -f flush1$(EXEEXT)
$(LINK) $(flush1_OBJECTS) $(flush1_LDADD) $(LIBS)
@@ -1038,6 +1045,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/external.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fheap.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fillval.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_fail.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flush1.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flush2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/freespace.Po@am__quote@
diff --git a/test/filter_fail.c b/test/filter_fail.c
new file mode 100644
index 0000000..abb25cd
--- /dev/null
+++ b/test/filter_fail.c
@@ -0,0 +1,382 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Raymond Lu <songyulu@hdfgroup.org>
+ * 7 September 2010
+ *
+ * Purpose: Make sure dataset, file, and library can close properly when a
+ * mandatory filter fails.
+ */
+
+#include "h5test.h"
+#include "H5srcdir.h"
+
+#define DSET_NAME "dset_fail"
+#define ONE_MB 1048576
+#define H5Z_FILTER_FAIL_TEST 312
+#define DIM 10
+#define FILTER_CHUNK_DIM 2
+
+const char *FILENAME[] = {
+ "filter_fail",
+ NULL
+};
+
+static size_t filter_fail(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+
+/* This message derives from H5Z */
+const H5Z_class2_t H5Z_FAIL_TEST[1] = {{
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_FAIL_TEST, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "filter_fail_test", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ filter_fail, /* The actual filter function */
+}};
+
+
+/*-------------------------------------------------------------------------
+ * Function: filter_fail
+ *
+ * Purpose: For testing library's behavior when a mandatory filter
+ * fails to write a chunk.
+ *
+ * Return: Success: Data chunk size
+ * Failure: 0
+ *
+ * Programmer: Raymond Lu
+ * 7 September 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+filter_fail(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
+{
+ int *dst = (int*)(*buf);
+ unsigned int offset;
+ unsigned int length;
+ unsigned int value;
+ size_t ret_value = 0;
+
+ if(flags & H5Z_FLAG_REVERSE) { /* do nothing during read */
+ *buf_size = nbytes;
+ ret_value = nbytes;
+ } /* end if */
+ else { /* Write data */
+ /* If it's the last chunk, pretend to fail. Otherwise, do nothing. */
+ if(*dst == 8 || *dst == 9) {
+ ret_value = 0;
+ } else {
+ *buf_size = nbytes;
+ ret_value = *buf_size;
+ }
+ } /* end else */
+
+error:
+ return ret_value;
+} /* end filter_fail() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_filter_write_failure
+ *
+ * Purpose: Tests the library's behavior when a mandate filter returns
+ * failure. There're only 5 chunks with each of them having
+ * 2 integers. The filter will fail in the last chunk. The
+ * dataset should release all resources even though the last
+ * chunk can't be flushed to file. The file should close
+ * successfully.
+ *
+ * Return:
+ * Success: 0
+ * Failure: -1
+ *
+ * Programmer: Raymond Lu
+ * 25 August 2010
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_filter_write(char *file_name, hid_t my_fapl)
+{
+ char filename[1024];
+ hid_t file = -1;
+ hid_t dataset=-1; /* dataset ID */
+ hid_t sid=-1; /* dataspace ID */
+ hid_t dcpl=-1; /* dataset creation property list ID */
+ hsize_t dims[1]={DIM}; /* dataspace dimension - 10*/
+ hsize_t chunk_dims[1]={FILTER_CHUNK_DIM}; /* chunk dimension - 2*/
+ int nfilters; /* number of filters in DCPL */
+ unsigned flags; /* flags for filter */
+ int points[DIM]; /* Data */
+ int rbuf[DIM]; /* Data */
+ herr_t ret; /* generic return value */
+ int i;
+
+ TESTING("data writing when a mandatory filter fails");
+
+ /* Create file */
+ if((file = H5Fcreate(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
+
+ /* create the data space */
+ if((sid = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR
+
+ /* Create dcpl and register the filter */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+
+ if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0) TEST_ERROR
+
+ if(H5Zregister (H5Z_FAIL_TEST) < 0) TEST_ERROR
+
+ /* Check that the filter was registered */
+ if(TRUE != H5Zfilter_avail(H5Z_FILTER_FAIL_TEST)) FAIL_STACK_ERROR
+
+ /* Enable the filter as mandatory */
+ if(H5Pset_filter(dcpl, H5Z_FILTER_FAIL_TEST, 0, (size_t)0, NULL) < 0)
+ TEST_ERROR
+
+ /* create a dataset */
+ if((dataset = H5Dcreate2(file, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Initialize the write buffer */
+ for(i = 0; i < DIM; i++)
+ points[i] = i;
+
+ /* Write data */
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, points) < 0) TEST_ERROR
+
+ /* clean up objects used for this test */
+ if(H5Pclose (dcpl) < 0) TEST_ERROR
+ if(H5Sclose (sid) < 0) TEST_ERROR
+
+ /* Dataset closing should fail */
+ H5E_BEGIN_TRY {
+ ret = H5Dclose (dataset);
+ } H5E_END_TRY;
+ if(ret >= 0) {
+ H5_FAILED();
+ puts(" Dataset is supposed to fail because the chunk can't be flushed to file.");
+ TEST_ERROR
+ }
+
+ /* Even though H5Dclose fails, it should release all resources.
+ * So the file should close successfully. */
+ if(H5Fclose (file) < 0) TEST_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ H5Dclose(dataset);
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return -1;
+} /* end test_filter_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_filter_read
+ *
+ * Purpose: Tests the library's behavior when a mandate filter returns
+ * failure. The first 4 chunks should be in the file. The
+ * last chunk should not.
+ *
+ * Return:
+ * Success: 0
+ * Failure: -1
+ *
+ * Programmer: Raymond Lu
+ * 25 August 2010
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_filter_read(char *file_name, hid_t my_fapl)
+{
+ hid_t file = -1;
+ hid_t dataset=-1; /* dataset ID */
+ hid_t sid = -1;
+ hid_t mspace = -1;
+ hsize_t dims[1]={DIM}; /* dataspace dimension - 10*/
+ hsize_t chunk_dims[1]={FILTER_CHUNK_DIM}; /* chunk dimension - 2*/
+ int rbuf[DIM]; /* Data */
+ hsize_t dset_size = 0; /* Dataset storage size */
+ hsize_t hs_offset[H5S_MAX_RANK];
+ hsize_t hs_size[H5S_MAX_RANK];
+ hsize_t stride[1] = {2};
+ hsize_t zero[8];
+ hsize_t nelmts = DIM/2;
+ int i;
+
+ TESTING("data reading when a mandatory filter fails");
+
+ /* Open file */
+ if((file = H5Fopen(file_name, H5F_ACC_RDONLY, my_fapl)) < 0) TEST_ERROR
+
+ /* Open dataset */
+ if((dataset = H5Dopen2(file, DSET_NAME, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Verify the storage size is equal to 4 chunks */
+ if((dset_size = H5Dget_storage_size(dataset)) == 0) TEST_ERROR
+
+ if(dset_size != 4 * FILTER_CHUNK_DIM * sizeof(int)) TEST_ERROR
+
+ /* Read the chunks */
+ HDmemset(rbuf, 0, DIM * sizeof(int));
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ TEST_ERROR
+
+ /* Check that the values read are the same as the values written.
+ * The last chunk should not be in the file. */
+ for(i = 0; i < DIM; i++) {
+ if(i < DIM-2 && rbuf[i] != i) {
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %d\n", i);
+ printf(" rbuf[%d]=%d\n", i, rbuf[i]);
+ TEST_ERROR
+ } else if(i >= DIM-2 && rbuf[i] != 0) {
+ H5_FAILED();
+ printf(" No value should be read.\n");
+ printf(" At index %d\n", i);
+ printf(" rbuf[%d]=%d\n", i, rbuf[i]);
+ TEST_ERROR
+ }
+ }
+
+ /* Try to read in hyperslab simulating the h5dump's way of printing data */
+ if((sid = H5Dget_space(dataset)) < 0) TEST_ERROR
+
+ HDmemset(hs_offset, 0, sizeof(hs_offset));
+ HDmemset(hs_size, 0, sizeof(hs_size));
+ hs_size[0] = DIM/2;
+
+ if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, stride, hs_size, NULL) < 0)
+ TEST_ERROR
+
+ /* create the data space */
+ if((mspace = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR
+
+ HDmemset(zero, 0, sizeof zero);
+
+ if(H5Sselect_hyperslab(mspace, H5S_SELECT_SET, zero, stride, &nelmts, NULL) < 0)
+ TEST_ERROR
+
+ HDmemset(rbuf, 0, DIM * sizeof(int));
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, rbuf) < 0)
+ TEST_ERROR
+
+ /* Check that the values read are the same as the values written.
+ * The last chunk should not be in the file. */
+ for(i = 0; i < DIM; i+=2) {
+ if(i < DIM-2 && rbuf[i] != i) {
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %d\n", i);
+ printf(" rbuf[%d]=%d\n", i, rbuf[i]);
+ TEST_ERROR
+ } else if(i >= DIM-2 && rbuf[i] != 0) {
+ H5_FAILED();
+ printf(" No value should be read.\n");
+ printf(" At index %d\n", i);
+ printf(" rbuf[%d]=%d\n", i, rbuf[i]);
+ TEST_ERROR
+ }
+ }
+
+ if(H5Sclose (sid) < 0) TEST_ERROR
+ if(H5Sclose (mspace) < 0) TEST_ERROR
+ if(H5Dclose (dataset) < 0) TEST_ERROR
+ if(H5Fclose (file) < 0) TEST_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Sclose(sid);
+ H5Sclose(mspace);
+ H5Dclose(dataset);
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return -1;
+} /* end test_filter_read() */
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Tests the library's behavior when a mandate filter returns
+ * failure.
+ *
+ * Return: Success: exit(0)
+ * Failure: exit(1)
+ *
+ * Programmer: Raymond Lu
+ * 25 August 2010
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int main(void)
+{
+ hid_t fapl;
+ int mdc_nelmts = 0;
+ size_t rdcc_nelmts = 521;
+ size_t rdcc_nbytes = ONE_MB;
+ double rdcc_w0 = 0.75;
+ char filename[1024];
+ unsigned nerrors = 0;
+
+ h5_reset();
+ fapl = h5_fileaccess();
+
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ /* Make sure the chunk cache is used. All values are default. */
+ if(H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0)
+ TEST_ERROR
+
+ nerrors += (test_filter_write(filename, fapl) < 0 ? 1 : 0);
+ nerrors += (test_filter_read(filename, fapl) < 0 ? 1 : 0);
+
+ h5_cleanup(FILENAME, fapl);
+
+ /* Make sure we can close the library */
+ if(H5close() < 0) TEST_ERROR
+
+ if (nerrors) TEST_ERROR
+
+ return 0;
+
+error:
+ if (nerrors) {
+ printf("***** %u FAILURE%s! *****\n",
+ nerrors, 1==nerrors?"":"S");
+ HDexit(1);
+ }
+}
diff --git a/test/tid.c b/test/tid.c
index 9bb93e7..561dc48 100644
--- a/test/tid.c
+++ b/test/tid.c
@@ -361,7 +361,7 @@ static int test_is_valid(void)
CHECK(ret, FAIL, "H5I_inc_ref");
if (ret < 0)
goto out;
- ret = H5I_dec_ref(dtype, TRUE);
+ ret = H5I_dec_ref(dtype, TRUE, FALSE);
CHECK(ret, FAIL, "H5I_dec_ref");
if (ret < 0)
goto out;
@@ -377,7 +377,7 @@ static int test_is_valid(void)
CHECK(nmembs1, FAIL, "H5I_nmembers");
if (nmembs1 < 0)
goto out;
- ret = H5I_dec_ref(dtype, FALSE);
+ ret = H5I_dec_ref(dtype, FALSE, FALSE);
CHECK(ret, FAIL, "H5I_dec_ref");
if (ret < 0)
goto out;