Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Simplify some leftover code and remove some old ...



details:   https://anonhg.NetBSD.org/src/rev/72ecbf23e630
branches:  trunk
changeset: 339695:72ecbf23e630
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Aug 03 17:33:54 2015 +0000

description:
Simplify some leftover code and remove some old assertions.

Last year when I killed off some evil dirop-related macros, I added
these assertions because if the things they asserted weren't true we'd
be leaking vnodes. Well, it seems that the code at the time did leak
vnodes, so certain failure cases (e.g. mkdir with disk full) would
assert. Nobody apparently tripped on this in the past fourteen months,
until I broke balloc so it always failed (unrelatedly) while working
on some LFS64 changes.

However, the vnode leak has since been removed by hannken@ as part of
the vnode cache changes, so the assertions are now superfluous;
instead, just make sure *vpp gets nulled on failure, and don't worry
about whether or not VU_DIROP is set as it shouldn't matter any more.

XXX: there's still a lot of gratuitous pointer aliasing in here that
should be tidied away.

diffstat:

 sys/ufs/lfs/lfs_vnops.c |  29 +++++------------------------
 1 files changed, 5 insertions(+), 24 deletions(-)

diffs (77 lines):

diff -r fed12f121c9e -r 72ecbf23e630 sys/ufs/lfs/lfs_vnops.c
--- a/sys/ufs/lfs/lfs_vnops.c   Mon Aug 03 12:11:52 2015 +0000
+++ b/sys/ufs/lfs/lfs_vnops.c   Mon Aug 03 17:33:54 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vnops.c,v 1.280 2015/08/02 18:12:59 dholland Exp $ */
+/*     $NetBSD: lfs_vnops.c,v 1.281 2015/08/03 17:33:54 dholland Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.280 2015/08/02 18:12:59 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.281 2015/08/03 17:33:54 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -687,13 +687,9 @@
        UNMARK_VNODE(dvp);
        /* XXX: is it even possible for the symlink to get MARK'd? */
        UNMARK_VNODE(*vpp);
-       if (!((*vpp)->v_uflag & VU_DIROP)) {
-               KASSERT(error != 0);
+       if (error) {
                *vpp = NULL;
        }
-       else {
-               KASSERT(error == 0);
-       }
        lfs_unset_dirop(fs, dvp, "symlink");
 
        vrele(dvp);
@@ -744,13 +740,6 @@
        /* Either way we're done with the dirop at this point */
        UNMARK_VNODE(dvp);
        UNMARK_VNODE(*vpp);
-       if (!((*vpp)->v_uflag & VU_DIROP)) {
-               KASSERT(error != 0);
-               *vpp = NULL;
-       }
-       else {
-               KASSERT(error == 0);
-       }
        lfs_unset_dirop(fs, dvp, "mknod");
        /*
         * XXX this is where this used to be (though inside some evil
@@ -843,13 +832,9 @@
 
        UNMARK_VNODE(dvp);
        UNMARK_VNODE(*vpp);
-       if (!((*vpp)->v_uflag & VU_DIROP)) {
-               KASSERT(error != 0);
+       if (error) {
                *vpp = NULL;
        }
-       else {
-               KASSERT(error == 0);
-       }
        lfs_unset_dirop(fs, dvp, "create");
 
        vrele(dvp);
@@ -1018,13 +1003,9 @@
 
        UNMARK_VNODE(dvp);
        UNMARK_VNODE(*vpp);
-       if (!((*vpp)->v_uflag & VU_DIROP)) {
-               KASSERT(error != 0);
+       if (error) {
                *vpp = NULL;
        }
-       else {
-               KASSERT(error == 0);
-       }
        lfs_unset_dirop(fs, dvp, "mkdir");
 
        vrele(dvp);



Home | Main Index | Thread Index | Old Index