summaryrefslogtreecommitdiffstats
path: root/src/H5I.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/H5I.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/H5I.c')
-rw-r--r--src/H5I.c29
1 files changed, 21 insertions, 8 deletions
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);