From 021919206df7764f951037ae76ccae006b2eea99 Mon Sep 17 00:00:00 2001
From: Vailin Choi <vchoi@jam.ad.hdfgroup.org>
Date: Fri, 23 Aug 2019 15:06:19 -0500
Subject: Fixed the assertion failure for HDFFV-10873.

---
 release_docs/RELEASE.txt | 14 ++++++++++++++
 src/H5Ochunk.c           |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index b940095..202d39d 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -326,6 +326,20 @@ Bug Fixes since HDF5-1.10.3 release
 
     Library
     -------
+    - Fixed a bug caused by bad tag value when condensing object header
+      messages
+
+      There was an assertion failure when moving meessages from running a
+      user test program with library release hdf5.1.10.4. It was because
+      the tag value (object header's address) was not set up when entering
+      the library routine H5O__chunk_update_idx(), which will eventually 
+      verifies the metadata tag value when protecting the object header.
+
+      The problem was fixed by replacing FUNC_ENTER_PACKAGE in H5O__chunk_update_idx() 
+      with FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr) to set up the metadata tag.
+
+      (VC - 2019/08/23, HDFFV-10873)
+
     - Fixed the test failure from test_metadata_read_retry_info() in
       test/swmr.c
 
diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c
index 94301b3..9ce5a46 100644
--- a/src/H5Ochunk.c
+++ b/src/H5Ochunk.c
@@ -331,7 +331,7 @@ H5O__chunk_update_idx(H5F_t *f, H5O_t *oh, unsigned idx)
     H5O_chk_cache_ud_t chk_udata;       /* User data for loading chunk */
     herr_t ret_value = SUCCEED;         /* Return value */
 
-    FUNC_ENTER_PACKAGE
+    FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr)
 
     /* check args */
     HDassert(f);
-- 
cgit v0.12


From 3090ac81506094ee510ae89c31749b5c1632aa34 Mon Sep 17 00:00:00 2001
From: Quincey Koziol <koziol@koziol.gov>
Date: Mon, 26 Aug 2019 14:38:58 -0500
Subject: Add a 'closing' flag on the shared file struct, and switch several of
 the "internal" data structures to use it.

---
 src/H5FSsection.c    | 4 ++--
 src/H5Fint.c         | 3 +++
 src/H5Fpkg.h         | 1 +
 src/H5MFaggr.c       | 4 ++--
 src/H5Ocache_image.c | 2 +-
 5 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/H5FSsection.c b/src/H5FSsection.c
index 9f86aea..df67bd9 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -390,7 +390,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n"
                 cache_flags |= H5AC__DIRTIED_FLAG;
 
                 /* On file close or flushing, does not allow section info to shrink in size */
-                if(f->closing || flush_in_progress) {
+                if(f->shared->closing || flush_in_progress) {
                     if(fspace->sect_size > fspace->alloc_sect_size)
                         cache_flags |= H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG;
                     else
@@ -441,7 +441,7 @@ HDfprintf(stderr, "%s: Relinquishing section info ownership\n", FUNC);
                     /* Set flag to release section info space in file */
                     /* On file close or flushing, only need to release section info with size 
                        bigger than previous section */
-                    if(f->closing || flush_in_progress) {
+                    if(f->shared->closing || flush_in_progress) {
                         if(fspace->sect_size > fspace->alloc_sect_size)
                             release_sinfo_space = TRUE;
                         else
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 9b31d7e..c56bd10 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -1175,6 +1175,9 @@ H5F__dest(H5F_t *f, hbool_t flush)
     if(1 == f->shared->nrefs) {
         int actype;                         /* metadata cache type (enum value) */
 
+        /* Mark this file as closing */
+        f->shared->closing = TRUE;
+
         /* Flush at this point since the file will be closed (phase 1).
          * Only try to flush the file if it was opened with write access, and if
          * the caller requested a flush.
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 42c9a828..7e89111 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -309,6 +309,7 @@ struct H5F_shared_t {
     struct H5G_t *root_grp;	/* Open root group			*/
     H5FO_t *open_objs;          /* Open objects in file                 */
     H5UC_t *grp_btree_shared;   /* Ref-counted group B-tree node info   */
+    hbool_t     closing;        /* File is in the process of being closed */
 
     /* Cached VOL connector ID & info */
     hid_t       vol_id;         /* ID of VOL connector for the container */
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index c726341..d716ae2 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -194,9 +194,9 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
      * the cache eventually adjusts/evicts ageout entries and ends up flushing out the
      * same entry that is being serialized (flush_in_progress).
      */ 
-    if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FSPACE_STRATEGY_NONE && (!f->closing || !f->shared->fs_persist)) {
+    if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FSPACE_STRATEGY_NONE && (!f->shared->closing || !f->shared->fs_persist)) {
 #ifdef REPLACE
-    if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FSPACE_STRATEGY_NONE && !f->closing) {
+    if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FSPACE_STRATEGY_NONE && !f->shared->closing) {
 #endif
         haddr_t	aggr_frag_addr = HADDR_UNDEF;   /* Address of aggregrator fragment */
         hsize_t	aggr_frag_size = 0;             /* Size of aggregator fragment */
diff --git a/src/H5Ocache_image.c b/src/H5Ocache_image.c
index 7336211..70d9ef5 100644
--- a/src/H5Ocache_image.c
+++ b/src/H5Ocache_image.c
@@ -325,7 +325,7 @@ H5O__mdci_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg)
 
 
 
-        if(f->closing) {
+        if(f->shared->closing) {
 
             /* Get the eoa, and verify that it has the expected value */
             if(HADDR_UNDEF == (final_eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT)) )
-- 
cgit v0.12