diff options
author | Mike McGreevy <mamcgree@hdfgroup.org> | 2010-09-01 18:01:58 (GMT) |
---|---|---|
committer | Mike McGreevy <mamcgree@hdfgroup.org> | 2010-09-01 18:01:58 (GMT) |
commit | 1a119d500af81e3e0a121943443e916dc11f1aba (patch) | |
tree | 8b28198ba33616883a8353ede68d7e7a50d64135 | |
parent | 642f392ba3e2d30ae2a82e32f249461121d17cbc (diff) | |
download | hdf5-1a119d500af81e3e0a121943443e916dc11f1aba.zip hdf5-1a119d500af81e3e0a121943443e916dc11f1aba.tar.gz hdf5-1a119d500af81e3e0a121943443e916dc11f1aba.tar.bz2 |
[svn-r19338] Purpose:
Fix bug in super-block load during SWMR read case.
Description:
This patch skips over the file truncation check whilst loading
the super-block when the intent is set to SWMR read. The single writer
process may have only partially flushed the file that one of the readers
is trying to open, and this check for truncation would fail in that case.
Tested:
jam
-rw-r--r-- | src/H5Fsuper_cache.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 6305888..68e5551 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -462,12 +462,18 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata) * possible is if the first file of a family of files was opened * individually. */ - if(HADDR_UNDEF == (eof = H5FD_get_eof(lf))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to determine file size") + /* (This check can be skipped when the file is opened for SWMR read, + * as the file can appear truncated if only part of it has been + * been flushed to disk by the single writer process.) + */ + if (!(f->intent && H5F_ACC_SWMR_READ)) { + if(HADDR_UNDEF == (eof = H5FD_get_eof(lf))) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to determine file size") - /* (Account for the stored EOA being absolute offset -QAK) */ - if((eof + sblock->base_addr) < stored_eoa) - HGOTO_ERROR(H5E_FILE, H5E_TRUNCATED, NULL, "truncated file") + /* (Account for the stored EOA being absolute offset -QAK) */ + if((eof + sblock->base_addr) < stored_eoa) + HGOTO_ERROR(H5E_FILE, H5E_TRUNCATED, NULL, "truncated file") + } /* end if */ /* * Tell the file driver how much address space has already been |