Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/ufs/ufs/ufs_dirhash.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/ufs/ufs/ufs_dirhash.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.36 retrieving revision 1.37 diff -u -p -r1.36 -r1.37 --- src/sys/ufs/ufs/ufs_dirhash.c 2014/02/25 18:30:13 1.36 +++ src/sys/ufs/ufs/ufs_dirhash.c 2014/12/20 00:28:05 1.37 @@ -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 -__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 @@ ufsdirhash_build(struct inode *ip) 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 @@ fail: 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 @@ ufsdirhash_free(struct inode *ip) 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 @@ ufsdirhash_free(struct inode *ip) } mutex_destroy(&dh->dh_lock); pool_cache_put(ufsdirhash_cache, dh); - ip->i_dirhash = NULL; atomic_add_int(&ufs_dirhashmem, -mem); }