summaryrefslogtreecommitdiffstats
path: root/src/H5Ocopy.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2011-10-13 23:10:50 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2011-10-13 23:10:50 (GMT)
commit56960ac85c40c3b08989ff776d2a69c6e79a6f09 (patch)
treebc1aeb7b0a4e8f9ee1d731524d904022b4f1e2d7 /src/H5Ocopy.c
parent1406da6362e460a6dc5a3882ec0f62dca159b9a5 (diff)
downloadhdf5-56960ac85c40c3b08989ff776d2a69c6e79a6f09.zip
hdf5-56960ac85c40c3b08989ff776d2a69c6e79a6f09.tar.gz
hdf5-56960ac85c40c3b08989ff776d2a69c6e79a6f09.tar.bz2
[svn-r21556] Purpose: Fix bug in H5Ocopy
Description: H5Ocopy could get confused when copying a named datatype containing an attribute which used that named datatype as its datatype. This happened because H5Ocopy would recurse into the attribute's datatype before the object the attribute was in was fully copied (i.e. before the "post-copy" pass). Modified H5Ocopy to avoid recursing before the post-copy step in this case. Required many changes, including to how non-committed shared messages are copied. Tested: jam, koala, heiwa (h5committest); durandal
Diffstat (limited to 'src/H5Ocopy.c')
-rw-r--r--src/H5Ocopy.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 1ecd16f..7f121d9 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -688,6 +688,18 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
if(H5SL_insert(cpy_info->map_list, addr_map, &(addr_map->src_obj_pos)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object into skip list")
+ /* Set metadata tag for destination object's object header */
+ H5_BEGIN_TAG(dxpl_id, oloc_dst->addr, FAIL);
+
+ /* Insert destination object header in cache. Insert before post copy loop
+ * so anything that references this object header can find it. Insert
+ * pinned so we can continue using oh_dst. */
+ if(H5AC_insert_entry(oloc_dst->file, dxpl_id, H5AC_OHDR, oloc_dst->addr, oh_dst, H5AC__PIN_ENTRY_FLAG) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header")
+
+ /* Reset metadata tag */
+ H5_END_TAG(FAIL);
+
/* "post copy" loop over messages, to fix up any messages which require a complete
* object header for destination object
*/
@@ -738,17 +750,11 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
oh_dst->nlink += (unsigned)addr_map->inc_ref_count;
} /* end if */
- /* Set metadata tag for destination object's object header */
- H5_BEGIN_TAG(dxpl_id, oloc_dst->addr, FAIL);
-
- /* Insert destination object header in cache */
- if(H5AC_insert_entry(oloc_dst->file, dxpl_id, H5AC_OHDR, oloc_dst->addr, oh_dst, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header")
+ /* Unpin oh_dst */
+ if(H5AC_unpin_entry(oh_dst) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "can't unpin object header")
oh_dst = NULL;
- /* Reset metadat tag */
- H5_END_TAG(FAIL);
-
/* Retag all copied metadata to apply the destination object's tag */
if(H5AC_retag_copied_metadata(oloc_dst->file, oloc_dst->addr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "unable to re-tag metadata entries")