diff options
author | David Young <dyoung@hdfgroup.org> | 2020-03-12 19:00:07 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2020-03-12 19:00:07 (GMT) |
commit | 7613f7e1aa89210bb625d59d79a6220c49a1f22c (patch) | |
tree | ea9ec922ecee66b45b90e5cd2024332930fcf1f0 | |
parent | 9abbdeaa66c70a00b6a7bedee9c76d2493a8e947 (diff) | |
parent | 093c2c7e69bc4a40e9d49eece1d6fdcf54e8ecb0 (diff) | |
download | hdf5-7613f7e1aa89210bb625d59d79a6220c49a1f22c.zip hdf5-7613f7e1aa89210bb625d59d79a6220c49a1f22c.tar.gz hdf5-7613f7e1aa89210bb625d59d79a6220c49a1f22c.tar.bz2 |
Merge pull request #2378 in HDFFV/hdf5 from ~DYOUNG/werror:dont-crash-on-close to develop
* commit '093c2c7e69bc4a40e9d49eece1d6fdcf54e8ecb0':
Avoid a crash, don't check if we're flushing when the file is closing: there's no need to check if the metadata cache is flushing if we already know the file is closing, because the condition we rely on is "closing OR flushing." Further, the cache may have already gone away, so sometimes calling into the cache to see if it's flushing will crash the program.
-rw-r--r-- | src/H5FSsection.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/H5FSsection.c b/src/H5FSsection.c index df67bd9..cf4a587 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -371,10 +371,10 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" /* Check if section info lock count dropped to zero */ if(fspace->sinfo_lock_count == 0) { hbool_t release_sinfo_space = FALSE; /* Flag to indicate section info space in file should be released */ - hbool_t flush_in_progress = FALSE; /* Is flushing in progress */ + hbool_t closing_or_flushing = f->shared->closing; /* Is closing or flushing in progress */ - /* Check whether cache is flush_in_progress */ - if(H5AC_get_cache_flush_in_progress(f->shared->cache, &flush_in_progress) < 0) + /* Check whether cache-flush is in progress if closing is not. */ + if(!closing_or_flushing && H5AC_get_cache_flush_in_progress(f->shared->cache, &closing_or_flushing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get flush_in_progress") /* Check if we actually protected the section info */ @@ -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->shared->closing || flush_in_progress) { + if(closing_or_flushing) { 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->shared->closing || flush_in_progress) { + if(closing_or_flushing) { if(fspace->sect_size > fspace->alloc_sect_size) release_sinfo_space = TRUE; else |