diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2009-01-29 20:43:16 (GMT) |
---|---|---|
committer | Neil Fortner <nfortne2@hdfgroup.org> | 2009-01-29 20:43:16 (GMT) |
commit | ec614163246fb78844d773b58b12d4451a4acaa4 (patch) | |
tree | 3f02a3e584278a5a94778659fac257033a6a73a9 /src/H5Ocache.c | |
parent | 9a298fd1dda2ed9b12e68cc64ccce5c95216fd6a (diff) | |
download | hdf5-ec614163246fb78844d773b58b12d4451a4acaa4.zip hdf5-ec614163246fb78844d773b58b12d4451a4acaa4.tar.gz hdf5-ec614163246fb78844d773b58b12d4451a4acaa4.tar.bz2 |
[svn-r16376] Purpose: Fix a bug encountered when copying shared messages
Description: When attempting to copy an object with a message shared in its own
object header, the library attempts to protect the same object header twice.
Previously, it was possible for the object header to be protected with write
access in one or both of these protects, which would be illegal. The library
should now always protect with read only access in this case. The conditions
for fixing incorrect datatype versions have been made weaker to support this
change. The version will only be corrected if the object header the datatype
is in is modified.
Tested: jam, smirom (h5committest)
Diffstat (limited to 'src/H5Ocache.c')
-rw-r--r-- | src/H5Ocache.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/H5Ocache.c b/src/H5Ocache.c index e5a772f..db093a4 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -880,12 +880,21 @@ HDfprintf(stderr, "%s: oh->cache_info.free_file_space_on_destroy = %t\n", FUNC, /* destroy messages */ if(oh->mesg) { for(u = 0; u < oh->nmesgs; u++) { - /* Verify that message is clean */ - HDassert(oh->mesg[u].dirty == 0); + /* Verify that message is clean, unless it could have been marked + * dirty by decoding */ +#ifndef NDEBUG + if(oh->ndecode_dirtied && oh->mesg[u].dirty) + oh->ndecode_dirtied--; + else + HDassert(oh->mesg[u].dirty == 0); +#endif /* NDEBUG */ H5O_msg_free_mesg(&oh->mesg[u]); } /* end for */ + /* Make sure we accounted for all the messages dirtied by decoding */ + HDassert(!oh->ndecode_dirtied); + oh->mesg = (H5O_mesg_t *)H5FL_SEQ_FREE(H5O_mesg_t, oh->mesg); } /* end if */ @@ -929,6 +938,11 @@ H5O_clear(H5F_t *f, H5O_t *oh, hbool_t destroy) for(u = 0; u < oh->nmesgs; u++) oh->mesg[u].dirty = FALSE; +#ifndef NDEBUG + /* Reset the number of messages dirtied by decoding */ + oh->ndecode_dirtied = 0; +#endif /* NDEBUG */ + /* Mark whole header as clean */ oh->cache_info.is_dirty = FALSE; |