James,
I verified that dm_set_return_on_destroy() does work, if the filesystem
is already mounted. However, it doesn't work in mid-mount, as you are trying
to do. This behavior matches what you will see on Irix.
In dm_handle_to_vp() we are making sure that nothing happens until a
filesystem's state has been changed from DM_STATE_MOUNTING to
DM_STATE_MOUNTED. I thought maybe it was too early for the VFS_ROOT() to
succeed, but I tried it anyway on Linux and it worked in the one simple case
that I gave it.
Because this restriction exists on both Irix and Linux, and because this
function is downwind of 30 or 40 or more other functions (only a few of which
I have examined), I'm not going to give much priority to changing it. I will
try the fix shown below in my Irix and Linux kernels for a while and maybe
someday I'll have a chance to give it a decent beating on Irix; I'll sit on
this until then.
Dean
*** /usr/tmp/TmpDir.908390-0/linux/fs/xfs_dmapi/dmapi_register.c_1.2 Tue Jan
22 15:19:44 2002
--- linux/fs/xfs_dmapi/dmapi_register.c Tue Jan 22 15:15:40 2002
***************
*** 466,477 ****
if ((fsrp = dm_find_fsreg_and_lock((fsid_t*)&handlep->ha_fsid, &lc)) ==
NULL)
return(NULL);
! if (fsrp->fr_state == DM_STATE_MOUNTING) {
mutex_spinunlock(&fsrp->fr_lock, lc);
return(NULL);
}
for (;;) {
if (fsrp->fr_state == DM_STATE_MOUNTED)
break;
if (fsrp->fr_state == DM_STATE_UNMOUNTED) {
--- 466,484 ----
if ((fsrp = dm_find_fsreg_and_lock((fsid_t*)&handlep->ha_fsid, &lc)) ==
NULL)
return(NULL);
! fidp = (fid_t*)&handlep->ha_fid;
! /* If mounting, and we are not asking for a filesystem handle,
! * then fail the request. (fid_len==0 for fshandle)
! */
! if ((fsrp->fr_state == DM_STATE_MOUNTING) &&
! (fidp->fid_len != 0)) {
mutex_spinunlock(&fsrp->fr_lock, lc);
return(NULL);
}
for (;;) {
+ if (fsrp->fr_state == DM_STATE_MOUNTING)
+ break;
if (fsrp->fr_state == DM_STATE_MOUNTED)
break;
if (fsrp->fr_state == DM_STATE_UNMOUNTED) {
***************
*** 496,502 ****
vnode.
*/
- fidp = (fid_t*)&handlep->ha_fid;
if (fidp->fid_len == 0) { /* filesystem handle */
VFS_ROOT(fsrp->fr_vfsp, &vp, error);
} else { /* file object handle */
--- 503,508 ----
|