diff options
author | julian <julian@FreeBSD.org> | 1996-08-13 19:48:41 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1996-08-13 19:48:41 +0000 |
commit | a5c4b942996b781ebfd1e0532c61c9fa4200c00b (patch) | |
tree | 66b326301a433f42bf6363b6912834c948139cba /sys/miscfs/devfs | |
parent | cebbb4d75dc810dc5b828857e106d0047dc14d1e (diff) | |
download | FreeBSD-src-a5c4b942996b781ebfd1e0532c61c9fa4200c00b.zip FreeBSD-src-a5c4b942996b781ebfd1e0532c61c9fa4200c00b.tar.gz |
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.?
Diffstat (limited to 'sys/miscfs/devfs')
-rw-r--r-- | sys/miscfs/devfs/devfs_tree.c | 5 | ||||
-rw-r--r-- | sys/miscfs/devfs/devfs_vnops.c | 17 |
2 files changed, 13 insertions, 9 deletions
diff --git a/sys/miscfs/devfs/devfs_tree.c b/sys/miscfs/devfs/devfs_tree.c index 192ec54..354434d 100644 --- a/sys/miscfs/devfs/devfs_tree.c +++ b/sys/miscfs/devfs/devfs_tree.c @@ -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; } diff --git a/sys/miscfs/devfs/devfs_vnops.c b/sys/miscfs/devfs/devfs_vnops.c index 3b6352c..0f7d340 100644 --- a/sys/miscfs/devfs/devfs_vnops.c +++ b/sys/miscfs/devfs/devfs_vnops.c @@ -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 @@ abortit: cache_purge(vp); /*XXX*/ dev_free_name(tnp); tp = NULL; + vput(vp); vput(dvp); return (error); } @@ -989,7 +987,6 @@ abortit: 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; } |