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:
Julian Elischer 1996-08-13 19:48:41 +00:00
parent cc98643e68
commit def534af64
2 changed files with 13 additions and 9 deletions

View File

@ -2,7 +2,7 @@
/*
* 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"
@ -889,7 +889,7 @@ DBPRINT(("dntovn "));
}
if(vn_p->v_type != VNON)
{
vget(vn_p,0/*lockflag ?*/); /*XXX*/
vget(vn_p,1); /*XXX*/
*vn_pp = vn_p;
return(0);
}
@ -954,6 +954,7 @@ DBPRINT(("(New vnode)"));
{
error = EINVAL;
}
VOP_LOCK(vn_p);
}
return error;
}

View File

@ -1,7 +1,7 @@
/*
* 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.
*/
@ -267,7 +267,6 @@ DBPRINT(("MKACCESS "));
* implements append-only directories.
*/
devfs_dntovn(new_node,result_vnode);
VOP_LOCK((*result_vnode));
#ifdef NOTYET
if ((dir_node->mode & ISVTX) &&
cnp->cn_cred->cr_uid != 0 &&
@ -302,7 +301,6 @@ DBPRINT(("MKACCESS "));
if (dir_node == new_node)
return (EISDIR);
devfs_dntovn(new_node,result_vnode);
VOP_LOCK(*result_vnode);
/* hmm save the 'from' name (we need to delete it) */
cnp->cn_flags |= SAVENAME;
if (!lockparent)
@ -333,7 +331,6 @@ DBPRINT(("MKACCESS "));
if (flags & ISDOTDOT) {
VOP_UNLOCK(dir_vnode); /* race to get the node */
devfs_dntovn(new_node,result_vnode);
VOP_LOCK(*result_vnode);
if (lockparent && (flags & ISLASTCN))
VOP_LOCK(dir_vnode);
} else if (dir_node == new_node) {
@ -341,7 +338,6 @@ DBPRINT(("MKACCESS "));
*result_vnode = dir_vnode;
} else {
devfs_dntovn(new_node,result_vnode);
VOP_LOCK(*result_vnode);
if (!lockparent || (flags & ISLASTCN))
VOP_UNLOCK(dir_vnode);
}
@ -376,6 +372,7 @@ devfs_create(struct vop_mknod_args *ap)
} */
{
DBPRINT(("create\n"));
vput(ap->a_dvp);
return EINVAL;
}
@ -921,6 +918,7 @@ DBPRINT(("remove\n"));
cache_purge(vp); /*XXX*/
dev_free_name(tnp);
tp = NULL;
vput(vp);
vput(dvp);
return (error);
}
@ -989,7 +987,6 @@ DBPRINT(("link\n"));
fp,
&tnp);
out:
vrele(vp);
vput(tdvp);
return (error);
@ -1248,6 +1245,7 @@ devfs_mkdir(struct vop_mkdir_args *ap)
} */
{
DBPRINT(("mkdir\n"));
vput(ap->a_dvp);
return EINVAL;
}
@ -1260,6 +1258,8 @@ devfs_rmdir(struct vop_rmdir_args *ap)
} */
{
DBPRINT(("rmdir\n"));
vput(ap->a_dvp);
vput(ap->a_vp);
return 0;
}
#endif
@ -1289,10 +1289,13 @@ DBPRINT(("symlink\n"));
by.Slnk.namelen = strlen(ap->a_target);
dev_add_entry( ap->a_cnp->cn_nameptr, dnp, DEV_SLNK, &by, &nm_p);
if(err = devfs_dntovn(nm_p->dnp,&vp) ) {
vput(ap->a_dvp);
return err;
}
*ap->a_vpp = vp;
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;
}