summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-05-13 20:05:51 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-05-13 20:05:51 (GMT)
commitc09dbf51850ad732c31e206c4841becf3ece067b (patch)
tree1d51146b4fc15bd801157e02719601cb34fdb728
parent394656ceba509c1c31005f844a707a7e3f6bfff5 (diff)
downloadhdf5-c09dbf51850ad732c31e206c4841becf3ece067b.zip
hdf5-c09dbf51850ad732c31e206c4841becf3ece067b.tar.gz
hdf5-c09dbf51850ad732c31e206c4841becf3ece067b.tar.bz2
[svn-r6869] Purpose:
Bug fix. Description: When the same dataset is opened more than once and those references to the object are left dangling, the library would not correctly shut down the dataset API, potentially allowing the file to be truncated. Solution: "force" the dataset IDs to be released when the dataset API is being shut down by the library. Platforms tested: FreeBSD 4.8 (sleipnir) h5committested
-rw-r--r--src/H5D.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 49df6c3..499feed 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -407,7 +407,29 @@ H5D_term_interface(void)
if (interface_initialize_g) {
if ((n=H5I_nmembers(H5I_DATASET))) {
- H5I_clear_group(H5I_DATASET, FALSE);
+ /* The dataset API uses the "force" flag set to true because it
+ * is using the "file objects" (H5FO) API functions to track open
+ * objects in the file. Using the H5FO code means that dataset
+ * IDs can have reference counts >1, when an existing dataset is
+ * opened more than once. However, the H5I code does not attempt
+ * to close objects with reference counts>1 unless the "force" flag
+ * is set to true.
+ *
+ * At some point (probably after the group and datatypes use the
+ * the H5FO code), the H5FO code might need to be switched around
+ * to storing pointers to the objects being tracked (H5D_t, H5G_t,
+ * etc) and reference count those itself instead of relying on the
+ * reference counting in the H5I layer. Then, the "force" flag can
+ * be put back to false.
+ *
+ * Setting the "force" flag to true for all the interfaces won't
+ * work because the "file driver" (H5FD) APIs use the H5I reference
+ * counting to avoid closing a file driver out from underneath an
+ * open file...
+ *
+ * QAK - 5/13/03
+ */
+ H5I_clear_group(H5I_DATASET, TRUE);
} else {
H5I_destroy_group(H5I_DATASET);
interface_initialize_g = 0;