Submitted by: doug Rabson (dfr@render.com)
cleaning up some of the vnode usage.. (I'm sure it still needs more..) where can one find out what each vfs call expects to be locked on completion, and how can one find out what each layer expects to be freed on error.?
This commit is contained in:
parent
813d29ff8c
commit
f55089f5bf
@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* Written by Julian Elischer (julian@DIALix.oz.au)
|
* Written by Julian Elischer (julian@DIALix.oz.au)
|
||||||
*
|
*
|
||||||
* $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_tree.c,v 1.27 1996/07/30 18:00:32 bde Exp $
|
* $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_tree.c,v 1.28 1996/08/13 07:21:44 julian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
@ -889,7 +889,7 @@ DBPRINT(("dntovn "));
|
|||||||
}
|
}
|
||||||
if(vn_p->v_type != VNON)
|
if(vn_p->v_type != VNON)
|
||||||
{
|
{
|
||||||
vget(vn_p,0/*lockflag ?*/); /*XXX*/
|
vget(vn_p,1); /*XXX*/
|
||||||
*vn_pp = vn_p;
|
*vn_pp = vn_p;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@ -954,6 +954,7 @@ DBPRINT(("(New vnode)"));
|
|||||||
{
|
{
|
||||||
error = EINVAL;
|
error = EINVAL;
|
||||||
}
|
}
|
||||||
|
VOP_LOCK(vn_p);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Written by Julian Elischer (julian@DIALix.oz.au)
|
* Written by Julian Elischer (julian@DIALix.oz.au)
|
||||||
*
|
*
|
||||||
* $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vnops.c,v 1.21 1996/06/12 05:08:34 gpalmer Exp $
|
* $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vnops.c,v 1.22 1996/08/13 07:21:45 julian Exp $
|
||||||
*
|
*
|
||||||
* symlinks can wait 'til later.
|
* symlinks can wait 'til later.
|
||||||
*/
|
*/
|
||||||
@ -267,7 +267,6 @@ DBPRINT(("MKACCESS "));
|
|||||||
* implements append-only directories.
|
* implements append-only directories.
|
||||||
*/
|
*/
|
||||||
devfs_dntovn(new_node,result_vnode);
|
devfs_dntovn(new_node,result_vnode);
|
||||||
VOP_LOCK((*result_vnode));
|
|
||||||
#ifdef NOTYET
|
#ifdef NOTYET
|
||||||
if ((dir_node->mode & ISVTX) &&
|
if ((dir_node->mode & ISVTX) &&
|
||||||
cnp->cn_cred->cr_uid != 0 &&
|
cnp->cn_cred->cr_uid != 0 &&
|
||||||
@ -302,7 +301,6 @@ DBPRINT(("MKACCESS "));
|
|||||||
if (dir_node == new_node)
|
if (dir_node == new_node)
|
||||||
return (EISDIR);
|
return (EISDIR);
|
||||||
devfs_dntovn(new_node,result_vnode);
|
devfs_dntovn(new_node,result_vnode);
|
||||||
VOP_LOCK(*result_vnode);
|
|
||||||
/* hmm save the 'from' name (we need to delete it) */
|
/* hmm save the 'from' name (we need to delete it) */
|
||||||
cnp->cn_flags |= SAVENAME;
|
cnp->cn_flags |= SAVENAME;
|
||||||
if (!lockparent)
|
if (!lockparent)
|
||||||
@ -333,7 +331,6 @@ DBPRINT(("MKACCESS "));
|
|||||||
if (flags & ISDOTDOT) {
|
if (flags & ISDOTDOT) {
|
||||||
VOP_UNLOCK(dir_vnode); /* race to get the node */
|
VOP_UNLOCK(dir_vnode); /* race to get the node */
|
||||||
devfs_dntovn(new_node,result_vnode);
|
devfs_dntovn(new_node,result_vnode);
|
||||||
VOP_LOCK(*result_vnode);
|
|
||||||
if (lockparent && (flags & ISLASTCN))
|
if (lockparent && (flags & ISLASTCN))
|
||||||
VOP_LOCK(dir_vnode);
|
VOP_LOCK(dir_vnode);
|
||||||
} else if (dir_node == new_node) {
|
} else if (dir_node == new_node) {
|
||||||
@ -341,7 +338,6 @@ DBPRINT(("MKACCESS "));
|
|||||||
*result_vnode = dir_vnode;
|
*result_vnode = dir_vnode;
|
||||||
} else {
|
} else {
|
||||||
devfs_dntovn(new_node,result_vnode);
|
devfs_dntovn(new_node,result_vnode);
|
||||||
VOP_LOCK(*result_vnode);
|
|
||||||
if (!lockparent || (flags & ISLASTCN))
|
if (!lockparent || (flags & ISLASTCN))
|
||||||
VOP_UNLOCK(dir_vnode);
|
VOP_UNLOCK(dir_vnode);
|
||||||
}
|
}
|
||||||
@ -376,6 +372,7 @@ devfs_create(struct vop_mknod_args *ap)
|
|||||||
} */
|
} */
|
||||||
{
|
{
|
||||||
DBPRINT(("create\n"));
|
DBPRINT(("create\n"));
|
||||||
|
vput(ap->a_dvp);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -921,6 +918,7 @@ DBPRINT(("remove\n"));
|
|||||||
cache_purge(vp); /*XXX*/
|
cache_purge(vp); /*XXX*/
|
||||||
dev_free_name(tnp);
|
dev_free_name(tnp);
|
||||||
tp = NULL;
|
tp = NULL;
|
||||||
|
vput(vp);
|
||||||
vput(dvp);
|
vput(dvp);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
@ -989,7 +987,6 @@ DBPRINT(("link\n"));
|
|||||||
fp,
|
fp,
|
||||||
&tnp);
|
&tnp);
|
||||||
out:
|
out:
|
||||||
vrele(vp);
|
|
||||||
vput(tdvp);
|
vput(tdvp);
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
@ -1248,6 +1245,7 @@ devfs_mkdir(struct vop_mkdir_args *ap)
|
|||||||
} */
|
} */
|
||||||
{
|
{
|
||||||
DBPRINT(("mkdir\n"));
|
DBPRINT(("mkdir\n"));
|
||||||
|
vput(ap->a_dvp);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1260,6 +1258,8 @@ devfs_rmdir(struct vop_rmdir_args *ap)
|
|||||||
} */
|
} */
|
||||||
{
|
{
|
||||||
DBPRINT(("rmdir\n"));
|
DBPRINT(("rmdir\n"));
|
||||||
|
vput(ap->a_dvp);
|
||||||
|
vput(ap->a_vp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1289,10 +1289,13 @@ DBPRINT(("symlink\n"));
|
|||||||
by.Slnk.namelen = strlen(ap->a_target);
|
by.Slnk.namelen = strlen(ap->a_target);
|
||||||
dev_add_entry( ap->a_cnp->cn_nameptr, dnp, DEV_SLNK, &by, &nm_p);
|
dev_add_entry( ap->a_cnp->cn_nameptr, dnp, DEV_SLNK, &by, &nm_p);
|
||||||
if(err = devfs_dntovn(nm_p->dnp,&vp) ) {
|
if(err = devfs_dntovn(nm_p->dnp,&vp) ) {
|
||||||
|
vput(ap->a_dvp);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
*ap->a_vpp = vp;
|
|
||||||
VOP_SETATTR(vp, ap->a_vap, ap->a_cnp->cn_cred, ap->a_cnp->cn_proc);
|
VOP_SETATTR(vp, ap->a_vap, ap->a_cnp->cn_cred, ap->a_cnp->cn_proc);
|
||||||
|
*ap->a_vpp = NULL;
|
||||||
|
vput(vp);
|
||||||
|
vput(ap->a_dvp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user