Module Name: src Committed By: hannken Date: Sat Oct 3 09:31:29 UTC 2015
Modified Files: src/sys/ufs/lfs: lfs_bio.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.134 -r1.135 src/sys/ufs/lfs/lfs_bio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/ufs/lfs/lfs_bio.c diff -u src/sys/ufs/lfs/lfs_bio.c:1.134 src/sys/ufs/lfs/lfs_bio.c:1.135 --- src/sys/ufs/lfs/lfs_bio.c:1.134 Wed Aug 12 18:28:01 2015 +++ src/sys/ufs/lfs/lfs_bio.c Sat Oct 3 09:31:29 2015 @@ -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 vn /* * 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 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 if (error) lfs_reserveavail(fs, vp, vp2, -fsb); -done: - holdrele(vp); - if (vp2 != NULL) { - holdrele(vp2); - } - return error; }