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 <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Ben Kaduk 2010-07-09 00:38:16 -04:00 committed by Derrick Brashear
parent 3ad8760f24
commit c658bfaf88

View File

@ -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;
}