summaryrefslogtreecommitdiffstats
path: root/src/H5Dbtree.c
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2020-06-12 16:24:27 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-06-12 16:24:27 (GMT)
commit625ef85fe56d8265989e8c1ed32331064012a068 (patch)
tree814195dc9c8e3620e9a85adc6e0e4e7569563485 /src/H5Dbtree.c
parentff43cd3631eaa13886933db3030728fc374c7123 (diff)
downloadhdf5-625ef85fe56d8265989e8c1ed32331064012a068.zip
hdf5-625ef85fe56d8265989e8c1ed32331064012a068.tar.gz
hdf5-625ef85fe56d8265989e8c1ed32331064012a068.tar.bz2
Avoid leaving a v1 B-tree used as a chunk index in a bad state
that makes assertions fail. Add an optional `close` method to the `H5D_chunk_ops_t`, and use that to release "holds" on metadata cache (MDC) entries. For extensible arrays and v2 B-trees, use the existing `dest`(roy) method to implement `close`. For v1 B-trees and other chunk indices, don't provide `close`: we cannot safely close the v1 B-tree index, and the other indices don't have a meaningful presence in the MDC. Revert my first attempt at making v1 B-tree chunk indices closeable with `dest`. Put my comment about the stopgap fix for VFD SWMR at the right place in src/H5Dchunk.c.
Diffstat (limited to 'src/H5Dbtree.c')
-rw-r--r--src/H5Dbtree.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c
index 996c89e..7741e99 100644
--- a/src/H5Dbtree.c
+++ b/src/H5Dbtree.c
@@ -166,7 +166,8 @@ const H5D_chunk_ops_t H5D_COPS_BTREE[1] = {{
H5D__btree_idx_size, /* size */
H5D__btree_idx_reset, /* reset */
H5D__btree_idx_dump, /* dump */
- H5D__btree_idx_dest /* destroy */
+ H5D__btree_idx_dest, /* destroy */
+ NULL /* close */
}};
@@ -1234,8 +1235,8 @@ H5D__btree_idx_delete(const H5D_chk_idx_info_t *idx_info)
/* Release the shared B-tree page */
if(NULL == tmp_storage.u.btree.shared)
- ; /* do nothing */
- else if(H5UC_DEC(tmp_storage.u.btree.shared) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "ref-counted page nil")
+ if(H5UC_DEC(tmp_storage.u.btree.shared) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page")
} /* end if */
@@ -1454,12 +1455,10 @@ H5D__btree_idx_dest(const H5D_chk_idx_info_t *idx_info)
/* Free the raw B-tree node buffer */
if(NULL == idx_info->storage->u.btree.shared)
- HGOTO_DONE(SUCCEED);
+ HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil")
if(H5UC_DEC(idx_info->storage->u.btree.shared) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page")
- idx_info->storage->u.btree.shared = NULL;
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree_idx_dest() */
@@ -1519,8 +1518,9 @@ done:
/* Free the raw B-tree node buffer */
if(NULL == storage.u.btree.shared)
HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted shared info nil")
- else if(H5UC_DEC(storage.u.btree.shared) < 0)
- HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted shared info")
+ else
+ if(H5UC_DEC(storage.u.btree.shared) < 0)
+ HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted shared info")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)