summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5Dbtree2.c11
-rw-r--r--src/H5Dearray.c10
-rw-r--r--src/H5Dfarray.c10
-rw-r--r--src/H5Dio.c4
-rw-r--r--src/H5T.c29
-rw-r--r--src/H5Tprivate.h1
6 files changed, 62 insertions, 3 deletions
diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c
index 9de609f..3b9b803 100644
--- a/src/H5Dbtree2.c
+++ b/src/H5Dbtree2.c
@@ -1161,10 +1161,14 @@ H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *u
HDassert(udata);
/* Check if the v2 B-tree is open yet */
- if(NULL == idx_info->storage->u.btree2.bt2)
+ if(NULL == idx_info->storage->u.btree2.bt2) {
/* Open existing v2 B-tree */
if(H5D__bt2_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
+ } /* end if */
+ else /* Patch the top level file pointer contained in bt2 if needed */
+ if(H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer")
/* Set convenience pointer to v2 B-tree structure */
bt2 = idx_info->storage->u.btree2.bt2;
@@ -1479,6 +1483,11 @@ H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info)
/* Check if the v2-btree is open */
if(idx_info->storage->u.btree2.bt2) {
+
+ /* Patch the top level file pointer contained in bt2 if needed */
+ if(H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer")
+
/* Close v2 B-tree */
if(H5B2_close(idx_info->storage->u.btree2.bt2, idx_info->dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree")
diff --git a/src/H5Dearray.c b/src/H5Dearray.c
index 5a90dd2..9f95b30 100644
--- a/src/H5Dearray.c
+++ b/src/H5Dearray.c
@@ -1316,10 +1316,13 @@ H5D__earray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t
HDassert(udata);
/* Check if the extensible array is open yet */
- if(NULL == idx_info->storage->u.earray.ea)
+ if(NULL == idx_info->storage->u.earray.ea) {
/* Open the extensible array in file */
if(H5D__earray_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array")
+ } else /* Patch the top level file pointer contained in ea if needed */
+ if(H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch earray file pointer")
/* Set convenience pointer to extensible array structure */
ea = idx_info->storage->u.earray.ea;
@@ -1729,6 +1732,11 @@ H5D__earray_idx_dest(const H5D_chk_idx_info_t *idx_info)
/* Check if the extensible array is open */
if(idx_info->storage->u.earray.ea) {
+
+ /* Patch the top level file pointer contained in ea if needed */
+ if(H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch earray file pointer")
+
/* Close extensible array */
if(H5EA_close(idx_info->storage->u.earray.ea, idx_info->dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array")
diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c
index 7afeae6..3303370 100644
--- a/src/H5Dfarray.c
+++ b/src/H5Dfarray.c
@@ -1204,10 +1204,13 @@ H5D__farray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t
HDassert(udata);
/* Check if the fixed array is open yet */
- if(NULL == idx_info->storage->u.farray.fa)
+ if(NULL == idx_info->storage->u.farray.fa) {
/* Open the fixed array in file */
if(H5D__farray_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array")
+ } else /* Patch the top level file pointer contained in fa if needed */
+ if(H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch fixed array file pointer")
/* Set convenience pointer to fixed array structure */
fa = idx_info->storage->u.farray.fa;
@@ -1626,6 +1629,11 @@ H5D__farray_idx_dest(const H5D_chk_idx_info_t *idx_info)
/* Check if the fixed array is open */
if(idx_info->storage->u.farray.fa) {
+
+ /* Patch the top level file pointer contained in fa if needed */
+ if(H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch fixed array file pointer")
+
/* Close fixed array */
if(H5FA_close(idx_info->storage->u.farray.fa, idx_info->dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array")
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 7b3f553..5004132 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -939,6 +939,10 @@ H5D__typeinfo_init(const H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache,
HDassert(type_info);
HDassert(dset);
+ /* Patch the top level file pointer for dt->shared->u.vlen.f if needed */
+ if(H5T_patch_vlen_file(dset->shared->type, dset->oloc.file) < 0 )
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch VL datatype file pointer")
+
/* Initialize type info safely */
HDmemset(type_info, 0, sizeof(*type_info));
diff --git a/src/H5T.c b/src/H5T.c
index 1e9cdc6..765df7a 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -5453,3 +5453,32 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T_patch_file() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_patch_vlen_file
+ *
+ * Purpose: Patch the top-level file pointer contained in (dt->shared->u.vlen.f)
+ * to point to f. This is possible because
+ * the top-level file pointer can be closed out from under
+ * dt while dt is contained in the shared file's cache.
+ *
+ * Return: SUCCEED
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5T_patch_vlen_file(H5T_t *dt, H5F_t *f)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Sanity check */
+ HDassert(dt);
+ HDassert(dt->shared);
+ HDassert(f);
+
+ if((dt->shared->type == H5T_VLEN) && dt->shared->u.vlen.f != f)
+ dt->shared->u.vlen.f = f;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5T_patch_vlen_file() */
+
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 93fe599..17826ae 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -137,6 +137,7 @@ H5_DLL htri_t H5T_is_sensible(const H5T_t *dt);
H5_DLL uint32_t H5T_hash(H5F_t * file, const H5T_t *dt);
H5_DLL herr_t H5T_set_latest_version(H5T_t *dt);
H5_DLL herr_t H5T_patch_file(H5T_t *dt, H5F_t *f);
+H5_DLL herr_t H5T_patch_vlen_file(H5T_t *dt, H5F_t *f);
H5_DLL htri_t H5T_is_variable_str(const H5T_t *dt);
/* Reference specific functions */