summaryrefslogtreecommitdiffstats
path: root/src/H5I.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2010-09-08 17:12:18 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2010-09-08 17:12:18 (GMT)
commitec5f5c868fb4dad3452db045c627fe258b152cd2 (patch)
tree2d70e1cceb03c1d708eee738000681d7391cc8ae /src/H5I.c
parent4d88ec662b733cb6ec119e126dc96aa74ba4632b (diff)
downloadhdf5-ec5f5c868fb4dad3452db045c627fe258b152cd2.zip
hdf5-ec5f5c868fb4dad3452db045c627fe258b152cd2.tar.gz
hdf5-ec5f5c868fb4dad3452db045c627fe258b152cd2.tar.bz2
[svn-r19359] 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 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);