summaryrefslogtreecommitdiffstats
path: root/src/H5FS.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-08-14 18:41:40 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-08-14 18:41:40 (GMT)
commit92bdaa7d0f11564a523a86b6cb170d43842ff6ef (patch)
tree69c0d005493bf60057534f2618b85de39eac4133 /src/H5FS.c
parent665366d499eb7831d90655c704507c4920313361 (diff)
downloadhdf5-92bdaa7d0f11564a523a86b6cb170d43842ff6ef.zip
hdf5-92bdaa7d0f11564a523a86b6cb170d43842ff6ef.tar.gz
hdf5-92bdaa7d0f11564a523a86b6cb170d43842ff6ef.tar.bz2
[svn-r14086] Description:
Correct error in metadata cache entry logic for free space objects, where a free space header could unpin its entry in the cache, even when the sections for that free space manager were still in the cache and technically holding the header pinned. Fix problem by checking for the section info in the cache before allowing the header to unpin its cache entry. Tested on: FreeBSD/32 6.2 (duty) Mac OS X/32 10.4.10 (amazon) Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5FS.c')
-rw-r--r--src/H5FS.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/H5FS.c b/src/H5FS.c
index 73ef3c2..f1907b2 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -331,7 +331,7 @@ H5FS_close(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace)
HDassert(f);
HDassert(fspace);
#ifdef QAK
-HDfprintf(stderr, "%s: Entering\n", FUNC);
+HDfprintf(stderr, "%s: Entering, fspace = %p, fspace->sinfo = %p\n", FUNC, fspace, fspace->sinfo);
#endif /* QAK */
/* Check if section info is valid */
@@ -371,10 +371,22 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_c
} /* end if */
} /* end if */
else {
- /* Unpin the free space header in the cache */
- /* (the section info destructor would unpin it if the section info existed) */
- if(H5AC_unpin_entry(f, fspace) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin free space header")
+ unsigned sect_status = 0; /* Free space section's status in the metadata cache */
+
+ /* Check the free space section's status in the metadata cache */
+ if(H5AC_get_entry_status(f, fspace->sect_addr, &sect_status) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "unable to check metadata cache status for free space header")
+
+ /* If this free list header's section info is still in the cache, don't
+ * unpin the header - let the section info do it, when the section
+ * into is evicted from the cache. -QAK
+ */
+ if(!(sect_status & H5AC_ES__IN_CACHE)) {
+ /* Unpin the free space header in the cache */
+ /* (the section info destructor would unpin it if the section info existed) */
+ if(H5AC_unpin_entry(f, fspace) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin free space header")
+ } /* end if */
} /* end else */
/* Reset the header's pointer to the section info, so it will get pinned again