Clean up the rundown of the object backing a vnode. This should fix

NFS problems associated with forcible dismounts.
This commit is contained in:
John Dyson 1996-10-17 02:49:35 +00:00
parent bf41740b43
commit ad98052216
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=18973
4 changed files with 31 additions and 6 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94
* $Id: vfs_subr.c,v 1.60 1996/09/19 18:20:22 nate Exp $
* $Id: vfs_subr.c,v 1.61 1996/09/28 03:36:07 dyson Exp $
*/
/*
@ -979,8 +979,11 @@ vflush(mp, skipvp, flags)
(vp->v_writecount == 0 || vp->v_type != VREG))
continue;
if ((vp->v_usecount == 1) && vp->v_object) {
if (vp->v_object && (vp->v_object->flags & OBJ_VFS_REF)) {
vm_object_reference(vp->v_object);
pager_cache(vp->v_object, FALSE);
vp->v_object->flags &= ~OBJ_VFS_REF;
vm_object_deallocate(vp->v_object);
}
/*
@ -991,6 +994,7 @@ vflush(mp, skipvp, flags)
vgone(vp);
continue;
}
/*
* If FORCECLOSE is set, forcibly close the vnode. For block
* or character devices, revert to an anonymous device. For
@ -1149,6 +1153,11 @@ vgone(vp)
(void) tsleep((caddr_t) vp, PINOD, "vgone", 0);
return;
}
if (vp->v_object) {
vp->v_object->flags |= OBJ_VNODE_GONE;
}
/*
* Clean out the filesystem specific data.
*/

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94
* $Id: vfs_subr.c,v 1.60 1996/09/19 18:20:22 nate Exp $
* $Id: vfs_subr.c,v 1.61 1996/09/28 03:36:07 dyson Exp $
*/
/*
@ -979,8 +979,11 @@ vflush(mp, skipvp, flags)
(vp->v_writecount == 0 || vp->v_type != VREG))
continue;
if ((vp->v_usecount == 1) && vp->v_object) {
if (vp->v_object && (vp->v_object->flags & OBJ_VFS_REF)) {
vm_object_reference(vp->v_object);
pager_cache(vp->v_object, FALSE);
vp->v_object->flags &= ~OBJ_VFS_REF;
vm_object_deallocate(vp->v_object);
}
/*
@ -991,6 +994,7 @@ vflush(mp, skipvp, flags)
vgone(vp);
continue;
}
/*
* If FORCECLOSE is set, forcibly close the vnode. For block
* or character devices, revert to an anonymous device. For
@ -1149,6 +1153,11 @@ vgone(vp)
(void) tsleep((caddr_t) vp, PINOD, "vgone", 0);
return;
}
if (vp->v_object) {
vp->v_object->flags |= OBJ_VNODE_GONE;
}
/*
* Clean out the filesystem specific data.
*/

View File

@ -61,7 +61,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: vm_object.h,v 1.31 1996/09/28 03:33:31 dyson Exp $
* $Id: vm_object.h,v 1.32 1996/10/15 18:23:38 bde Exp $
*/
/*
@ -133,6 +133,7 @@ struct vm_object {
#define OBJ_VFS_REF 0x0400 /* object is refed by vfs layer */
#define OBJ_VNODE_GONE 0x0800 /* vnode is gone */
#define OBJ_NORMAL 0x0 /* default behavior */
#define OBJ_SEQUENTIAL 0x1 /* expect sequential accesses */
#define OBJ_RANDOM 0x2 /* expect random accesses */

View File

@ -38,7 +38,7 @@
* SUCH DAMAGE.
*
* from: @(#)vnode_pager.c 7.5 (Berkeley) 4/20/91
* $Id: vnode_pager.c,v 1.63 1996/08/21 21:56:23 dyson Exp $
* $Id: vnode_pager.c,v 1.64 1996/09/10 05:28:23 dyson Exp $
*/
/*
@ -614,6 +614,8 @@ vnode_pager_getpages(object, m, count, reqpage)
{
int rtval;
struct vnode *vp;
if (object->flags & OBJ_VNODE_GONE)
return VM_PAGER_ERROR;
vp = object->handle;
rtval = VOP_GETPAGES(vp, m, count*PAGE_SIZE, reqpage, 0);
if (rtval == EOPNOTSUPP)
@ -857,6 +859,10 @@ vnode_pager_putpages(object, m, count, sync, rtvals)
{
int rtval;
struct vnode *vp;
if (object->flags & OBJ_VNODE_GONE)
return VM_PAGER_ERROR;
vp = object->handle;
rtval = VOP_PUTPAGES(vp, m, count*PAGE_SIZE, sync, rtvals, 0);
if (rtval == EOPNOTSUPP)