Remove dubious vhold()/holdrele() from lfs_reserve().

The vnodes are always referenced on entry.

If we changed ulfs_remove() and ulfs_rmdir() to return the locked dvp
the vnodes were always locked on entry.

Remove an outdated comment from lfs_reserveavail(), unlocking/relocking
the vnode was removed in rev 1.49.
This commit is contained in:
hannken 2015-10-03 09:31:29 +00:00
parent da7186290f
commit 7de3300bb9
1 changed files with 5 additions and 30 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_bio.c,v 1.134 2015/08/12 18:28:01 dholland Exp $ */
/* $NetBSD: lfs_bio.c,v 1.135 2015/10/03 09:31:29 hannken Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.134 2015/08/12 18:28:01 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.135 2015/10/03 09:31:29 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -197,19 +197,10 @@ lfs_reservebuf(struct lfs *fs, struct vnode *vp,
/*
* Try to reserve some blocks, prior to performing a sensitive operation that
* requires the vnode lock to be honored. If there is not enough space, give
* up the vnode lock temporarily and wait for the space to become available.
* requires the vnode lock to be honored. If there is not enough space, wait
* for the space to become available.
*
* Called with vp locked. (Note nowever that if fsb < 0, vp is ignored.)
*
* XXX YAMT - it isn't safe to unlock vp here
* because the node might be modified while we sleep.
* (eg. cached states like i_offset might be stale,
* the vnode might be truncated, etc..)
* maybe we should have a way to restart the vnodeop (EVOPRESTART?)
* or rearrange vnodeop interface to leave vnode locking to file system
* specific code so that each file systems can have their own vnode locking and
* vnode re-using strategies.
*/
static int
lfs_reserveavail(struct lfs *fs, struct vnode *vp,
@ -301,19 +292,9 @@ lfs_reserve(struct lfs *fs, struct vnode *vp, struct vnode *vp2, int fsb)
mutex_exit(&lfs_lock);
#endif
/*
* XXX
* vref vnodes here so that cleaner doesn't try to reuse them.
* (see XXX comment in lfs_reserveavail)
*/
vhold(vp);
if (vp2 != NULL) {
vhold(vp2);
}
error = lfs_reserveavail(fs, vp, vp2, fsb);
if (error)
goto done;
return error;
/*
* XXX just a guess. should be more precise.
@ -322,12 +303,6 @@ lfs_reserve(struct lfs *fs, struct vnode *vp, struct vnode *vp2, int fsb)
if (error)
lfs_reserveavail(fs, vp, vp2, -fsb);
done:
holdrele(vp);
if (vp2 != NULL) {
holdrele(vp2);
}
return error;
}