Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/lfs Remove dubious vhold()/holdrele() from lfs_reser...



details:   https://anonhg.NetBSD.org/src/rev/be2b54ac8d5b
branches:  trunk
changeset: 340822:be2b54ac8d5b
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sat Oct 03 09:31:29 2015 +0000

description:
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.

diffstat:

 sys/ufs/lfs/lfs_bio.c |  35 +++++------------------------------
 1 files changed, 5 insertions(+), 30 deletions(-)

diffs (74 lines):

diff -r b5d766755e55 -r be2b54ac8d5b sys/ufs/lfs/lfs_bio.c
--- a/sys/ufs/lfs/lfs_bio.c     Sat Oct 03 08:30:13 2015 +0000
+++ b/sys/ufs/lfs/lfs_bio.c     Sat Oct 03 09:31:29 2015 +0000
@@ -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 @@
 
 /*
  * 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 @@
        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 @@
        if (error)
                lfs_reserveavail(fs, vp, vp2, -fsb);
 
-done:
-       holdrele(vp);
-       if (vp2 != NULL) {
-               holdrele(vp2);
-       }
-
        return error;
 }
 



Home | Main Index | Thread Index | Old Index