summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2015-06-15 18:35:00 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2015-06-15 18:35:00 (GMT)
commitf34bdad87c4af43bd09a6b9e6f8859cb268ce6ec (patch)
tree2b2afe99d1e53209e343a2fba6f8c4dfbba7f2e5
parentadbb64c6cd100915dfd62235c10d48a3b4162bd9 (diff)
downloadhdf5-f34bdad87c4af43bd09a6b9e6f8859cb268ce6ec.zip
hdf5-f34bdad87c4af43bd09a6b9e6f8859cb268ce6ec.tar.gz
hdf5-f34bdad87c4af43bd09a6b9e6f8859cb268ce6ec.tar.bz2
[svn-r27206] fix for HDFFV-9418.
- Moving truncate to H5F_flush() where it was done a long time ago. - Add a second H5AC_flush() call after the truncate is done to make sure we write the correct EOA. tested with h5committest
-rw-r--r--src/H5Fint.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/H5Fint.c b/src/H5Fint.c
index e012ba6..94d76cc 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -857,14 +857,6 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close property list")
- /* Only truncate the file on an orderly close, with write-access */
- if(f->closing && (H5F_ACC_RDWR & H5F_INTENT(f))) {
- /* Truncate the file to the current allocated size */
- if(H5FD_truncate(f->shared->lf, dxpl_id, (unsigned)TRUE) < 0)
- /* Push error, but keep going*/
- HDONE_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "low level truncate failed")
- } /* end if */
-
/* Close the file */
if(H5FD_close(f->shared->lf) < 0)
/* Push error, but keep going*/
@@ -1182,6 +1174,15 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, hbool_t closing)
/* Push error, but keep going*/
HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache")
+ /* Truncate the file to the current allocated size */
+ if(H5FD_truncate(f->shared->lf, dxpl_id, (unsigned)TRUE) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "low level truncate failed")
+
+ /* Flush the entire metadata cache again since the EOA could have changed in the truncate call. */
+ if(H5AC_flush(f, dxpl_id) < 0)
+ /* Push error, but keep going*/
+ HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache")
+
/* Set up I/O info for operation */
fio_info.f = f;
if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))