summaryrefslogtreecommitdiffstats
path: root/src/H5FDint.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5FDint.c')
-rw-r--r--src/H5FDint.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/H5FDint.c b/src/H5FDint.c
index 602559d..28dc3a1 100644
--- a/src/H5FDint.c
+++ b/src/H5FDint.c
@@ -233,6 +233,24 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf /*
HGOTO_DONE(SUCCEED)
#endif /* H5_HAVE_PARALLEL */
+ /* If the file is open for SWMR read access, allow access to data past
+ * the end of the allocated space (the 'eoa'). This is done because the
+ * eoa stored in the file's superblock might be out of sync with the
+ * objects being written within the file by the application performing
+ * SWMR write operations.
+ */
+ if (!(file->access_flags & H5F_ACC_SWMR_READ)) {
+ haddr_t eoa;
+
+ if (HADDR_UNDEF == (eoa = (file->cls->get_eoa)(file, type)))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed")
+
+ if ((addr + file->base_addr + size) > eoa)
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu, eoa = %llu",
+ (unsigned long long)(addr + file->base_addr), (unsigned long long)size,
+ (unsigned long long)eoa)
+ }
+
/* Dispatch to driver */
if ((file->cls->read)(file, type, dxpl_id, addr + file->base_addr, size, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed")