summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
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/H5D.c
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/H5D.c')
-rw-r--r--src/H5D.c32
1 files changed, 18 insertions, 14 deletions
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 */