diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-07-16 16:33:15 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-07-16 16:33:15 (GMT) |
commit | 5e98b5bb36c9e0b1078e56d9b734657fcfe7a03d (patch) | |
tree | 1bf4e62685089c126e5143617ccde2ff87e923e3 /src | |
parent | 0daa76a15095d395a3901ca1b1b38dcbc60ebb23 (diff) | |
download | hdf5-5e98b5bb36c9e0b1078e56d9b734657fcfe7a03d.zip hdf5-5e98b5bb36c9e0b1078e56d9b734657fcfe7a03d.tar.gz hdf5-5e98b5bb36c9e0b1078e56d9b734657fcfe7a03d.tar.bz2 |
[svn-r11077] Purpose:
Bug fix
Description:
Further progress on fixing file mounting to work properly.
Platforms tested:
FreeBSD 4.11 (sleipnir)
Linux 2.4
Too minor to require h5committest
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Fmount.c | 17 | ||||
-rw-r--r-- | src/H5G.c | 3 | ||||
-rw-r--r-- | src/H5O.c | 20 |
3 files changed, 32 insertions, 8 deletions
diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 73a450d..c67f40d 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -78,9 +78,14 @@ H5F_close_mounts(H5F_t *f) /* Unmount all child files */ for (u = 0; u < f->mtab.nmounts; u++) { + /* Detach the child file from the parent file */ f->mtab.child[u].file->mtab.parent = NULL; + + /* Close the internal group maintaining the mount point */ if(H5G_close(f->mtab.child[u].group) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close child group") + + /* Close the child file */ if(H5F_close(f->mtab.child[u].file) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close child file") } /* end if */ @@ -633,13 +638,13 @@ done: static hbool_t H5F_check_mounts_recurse(H5F_t *f) { - hbool_t ret_value; /* Return value */ + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_check_mounts_recurse) /* Check if this file is closing and if the only objects left open are * the mount points */ - if(f->closing && f->nopen_objs == f->mtab.nmounts) { + if((f->closing || (f->nrefs == 1 && f->mtab.parent)) && f->nopen_objs == f->mtab.nmounts) { unsigned u; /* Iterate over files mounted in this file and check if all can be closed */ @@ -648,9 +653,10 @@ H5F_check_mounts_recurse(H5F_t *f) || !H5F_check_mounts_recurse(f->mtab.child[u].file)) HGOTO_DONE(FALSE) } /* end for */ - } /* end if */ - ret_value = TRUE; + /* Set return value */ + ret_value = TRUE; + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -703,7 +709,8 @@ H5F_check_mounts(H5F_t *f) if(H5F_close_mounts(top) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't unmount child file") - H5I_dec_ref(top->closing); + if(H5I_dec_ref(top->closing) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't decrement file closing ID") } /* end if */ } /* end if */ @@ -2257,7 +2257,8 @@ H5G_close(H5G_t *grp) /* Check if this group was the last object holding open a mounted file * hierarchy and close down the file hierarchy if so */ if(grp->shared->fo_count == 1) - H5F_check_mounts(grp->ent.file); + if(H5F_check_mounts(grp->ent.file) < 0) + HGOTO_ERROR(H5E_SYM, H5E_MOUNT, FAIL, "problem checking mount hierarchy"); if(H5G_free_ent_name(&(grp->ent))<0) { @@ -428,8 +428,24 @@ H5O_close(H5G_entry_t *obj_ent) * pending then close the file and remove it from the H5I_FILE_CLOSING ID * group. */ - if (obj_ent->file->mtab.nmounts==obj_ent->file->nopen_objs && obj_ent->file->closing) - H5I_dec_ref(obj_ent->file->closing); + /* Check for just mount points holding file open */ + if(obj_ent->file->mtab.nmounts == obj_ent->file->nopen_objs && obj_ent->file->closing) { + unsigned u; /* Local index variable */ + hbool_t really_close; /* Whether to delay the file close by going to a "closing" state */ + + /* Check for open groups on mount points */ + really_close = TRUE; + for(u = 0; u < obj_ent->file->mtab.nmounts; u++) { + if(H5G_get_shared_count(obj_ent->file->mtab.child[u].group) > 1) { + really_close = FALSE; + break; + } /* end if */ + } /* end for */ + + /* If we really want to close this file now */ + if(really_close) + H5I_dec_ref(obj_ent->file->closing); + } /* end if */ /* Free the ID to name buffers */ H5G_free_ent_name(obj_ent); |