summaryrefslogtreecommitdiffstats
path: root/src/H5Oshared.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/H5Oshared.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/H5Oshared.c')
-rw-r--r--src/H5Oshared.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index 4ba01ac..4c5408d 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -285,7 +285,7 @@ H5O_shared_link_adj(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
} /* end if */
/* Check for incrementing reference count on message */
else if(adjust > 0) {
- if(H5SM_try_share(f, dxpl_id, open_oh, type->id, shared, NULL) < 0)
+ if(H5SM_try_share(f, dxpl_id, open_oh, FALSE, type->id, shared, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "error trying to share message")
} /* end if */
} /* end else */
@@ -610,7 +610,11 @@ H5O_shared_copy_file(H5F_t *file_src, H5F_t *file_dst,
/* Committed shared messages create a shared message at the destination
* and also copy the committed object that they point to.
*
- * SOHMs try to share the destination message.
+ * Other messages simulate sharing the destination message to determine how
+ * it will eventually be shared (if at all), but do not actually share the
+ * message until "post copy". The "H5O_shared_t" part of the message will
+ * be updated (to allow calculation of the final size) but the message is
+ * not actually shared.
*/
if(shared_src->type == H5O_SHARE_TYPE_COMMITTED) {
H5O_loc_t dst_oloc;
@@ -628,20 +632,15 @@ H5O_shared_copy_file(H5F_t *file_src, H5F_t *file_dst,
H5O_UPDATE_SHARED(shared_dst, H5O_SHARE_TYPE_COMMITTED, file_dst, mesg_type->id, 0, dst_oloc.addr)
} /* end if */
else {
- /* Try to share new message in the destination file. */
- /* Message is always shared in heap in dest. file because the dest.
- * object header doesn't quite exist yet - JML
- */
-
+ /* Simulate trying to share new message in the destination file. */
/* Set copied metadata tag */
H5_BEGIN_TAG(dxpl_id, H5AC__COPIED_TAG, FAIL);
- if(H5SM_try_share(file_dst, dxpl_id, NULL, mesg_type->id, _native_dst, NULL) < 0)
+ if(H5SM_try_share(file_dst, dxpl_id, NULL, TRUE, mesg_type->id, _native_dst, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to determine if message should be shared")
/* Reset metadata tag */
H5_END_TAG(FAIL);
-
} /* end else */
done:
@@ -687,12 +686,8 @@ H5O_shared_post_copy_file(H5F_t *f, hid_t dxpl_id, H5O_t *oh, void *mesg)
/* save the type id for later use */
msg_type_id = old_sh_mesg->msg_type_id;
- /* Remove the old message from the SOHM storage */
- if(H5SM_delete(f, dxpl_id, oh, old_sh_mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to find attribute information for object")
-
/* Add the new message */
- if((shared_mesg = H5SM_try_share(f, dxpl_id, oh, msg_type_id, mesg, NULL)) == 0)
+ if((shared_mesg = H5SM_try_share(f, dxpl_id, oh, FALSE, msg_type_id, mesg, NULL)) == 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "message changed sharing status")
else if(shared_mesg < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't share message")
@@ -701,7 +696,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_shared_post_copy_file() */
-
/*-------------------------------------------------------------------------
* Function: H5O_shared_debug