From c658bfaf884973aa47c8ce3072b96e6b7d8439c6 Mon Sep 17 00:00:00 2001 From: Ben Kaduk Date: Fri, 9 Jul 2010 00:38:16 -0400 Subject: [PATCH] Remove incorrect critical section use in dnlc_lookup Critical sections may not be used with (non-spin) locks. As such, this code was wrong, and led to a panic. We don't see why there what synchronization they may have been providing, so just remove them and do not replace them. Change-Id: I5d81595a7059a91b9aad46ab0a634fa684f67325 Reviewed-on: http://gerrit.openafs.org/2373 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/afs/afs_osidnlc.c | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/src/afs/afs_osidnlc.c b/src/afs/afs_osidnlc.c index 880702d74e..d8fea44313 100644 --- a/src/afs/afs_osidnlc.c +++ b/src/afs/afs_osidnlc.c @@ -61,14 +61,6 @@ int dnlct; #define dnlcHash(ts, hval) for (hval=0; *ts; ts++) { hval *= 173; hval += *ts; } -#if defined(AFS_FBSD80_ENV) && !defined(UKERNEL) -#define ma_critical_enter critical_enter -#define ma_critical_exit critical_exit -#else -#define ma_critical_enter() {} -#define ma_critical_exit() {} -#endif - static struct nc * GetMeAnEntry(void) { @@ -207,18 +199,12 @@ osi_dnlc_lookup(struct vcache *adp, char *aname, int locktype) vnode_t tvp; #endif - ma_critical_enter(); - - if (!afs_usednlc) { - ma_critical_exit(); + if (!afs_usednlc) return 0; - } dnlcHash(ts, key); /* leaves ts pointing at the NULL */ - if (ts - aname >= AFSNCNAMESIZE) { - ma_critical_exit(); + if (ts - aname >= AFSNCNAMESIZE) return 0; - } skey = key & (NHSIZE - 1); TRACE(osi_dnlc_lookupT, skey); @@ -242,7 +228,6 @@ osi_dnlc_lookup(struct vcache *adp, char *aname, int locktype) ReleaseReadLock(&afs_xdnlc); ReleaseReadLock(&afs_xvcache); osi_dnlc_purge(); - ma_critical_exit(); return (0); } } @@ -263,7 +248,6 @@ osi_dnlc_lookup(struct vcache *adp, char *aname, int locktype) ReleaseReadLock(&afs_xvcache); dnlcstats.misses++; osi_dnlc_remove(adp, aname, tvc); - ma_critical_exit(); return 0; } #if defined(AFS_DARWIN80_ENV) @@ -272,7 +256,6 @@ osi_dnlc_lookup(struct vcache *adp, char *aname, int locktype) ReleaseReadLock(&afs_xvcache); dnlcstats.misses++; osi_dnlc_remove(adp, aname, tvc); - ma_critical_exit(); return 0; } if (vnode_ref(tvp)) { @@ -282,17 +265,9 @@ osi_dnlc_lookup(struct vcache *adp, char *aname, int locktype) AFS_GLOCK(); dnlcstats.misses++; osi_dnlc_remove(adp, aname, tvc); - ma_critical_exit(); return 0; } -#elif defined(AFS_FBSD_ENV) - /* can't sleep in a critical section */ - ma_critical_exit(); osi_vnhold(tvc, 0); - ma_critical_enter(); -#else - osi_vnhold(tvc, 0); -#endif ReleaseReadLock(&afs_xvcache); #ifdef notdef @@ -329,7 +304,6 @@ osi_dnlc_lookup(struct vcache *adp, char *aname, int locktype) #endif } - ma_critical_exit(); return tvc; }