Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ufs clear i_dirhash sooner, but what lock protects it?



details:   https://anonhg.NetBSD.org/src/rev/f497a15cf06b
branches:  trunk
changeset: 334995:f497a15cf06b
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Dec 20 00:28:05 2014 +0000

description:
clear i_dirhash sooner, but what lock protects it?

diffstat:

 sys/ufs/ufs/ufs_dirhash.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (51 lines):

diff -r c1a8cfb1c1a0 -r f497a15cf06b sys/ufs/ufs/ufs_dirhash.c
--- a/sys/ufs/ufs/ufs_dirhash.c Fri Dec 19 22:25:39 2014 +0000
+++ b/sys/ufs/ufs/ufs_dirhash.c Sat Dec 20 00:28:05 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_dirhash.c,v 1.36 2014/02/25 18:30:13 pooka Exp $   */
+/*     $NetBSD: ufs_dirhash.c,v 1.37 2014/12/20 00:28:05 christos Exp $        */
 
 /*
  * Copyright (c) 2001, 2002 Ian Dowse.  All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_dirhash.c,v 1.36 2014/02/25 18:30:13 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_dirhash.c,v 1.37 2014/12/20 00:28:05 christos Exp $");
 
 /*
  * This implements a hash-based lookup scheme for UFS directories.
@@ -255,6 +255,7 @@
        return (0);
 
 fail:
+       ip->i_dirhash = NULL;
        DIRHASH_UNLOCK(dh);
        if (dh->dh_hash != NULL) {
                for (i = 0; i < narrays; i++)
@@ -266,7 +267,6 @@
                kmem_free(dh->dh_blkfree, dh->dh_blkfreesz);
        mutex_destroy(&dh->dh_lock);
        pool_cache_put(ufsdirhash_cache, dh);
-       ip->i_dirhash = NULL;
        atomic_add_int(&ufs_dirhashmem, -memreqd);
        return (-1);
 }
@@ -283,6 +283,8 @@
        if ((dh = ip->i_dirhash) == NULL)
                return;
 
+       ip->i_dirhash = NULL;
+
        if (dh->dh_onlist) {
                DIRHASHLIST_LOCK();
                if (dh->dh_onlist)
@@ -303,7 +305,6 @@
        }
        mutex_destroy(&dh->dh_lock);
        pool_cache_put(ufsdirhash_cache, dh);
-       ip->i_dirhash = NULL;
 
        atomic_add_int(&ufs_dirhashmem, -mem);
 }



Home | Main Index | Thread Index | Old Index