if (!avc)
return;
- if (avc->f.states & FCSBypass)
- osi_Panic("afs_TransitionToBypass: illegal transition to bypass--already FCSBypass\n");
-
if (aflags & TRANSChangeDesiredBit)
setDesire = 1;
if (aflags & TRANSSetManualBit)
#else
AFS_GLOCK();
#endif
+
ObtainWriteLock(&avc->lock, 925);
+ /*
+ * Someone may have beat us to doing the transition - we had no lock
+ * when we checked the flag earlier. No cause to panic, just return.
+ */
+ if (avc->f.states & FCSBypass)
+ goto done;
/* If we never cached this, just change state */
if (setDesire && (!(avc->cachingStates & FCSBypass))) {
if (!avc)
return;
- if (!(avc->f.states & FCSBypass))
- osi_Panic("afs_TransitionToCaching: illegal transition to caching--already caching\n");
-
if (aflags & TRANSChangeDesiredBit)
resetDesire = 1;
if (aflags & TRANSSetManualBit)
AFS_GLOCK();
#endif
ObtainWriteLock(&avc->lock, 926);
+ /*
+ * Someone may have beat us to doing the transition - we had no lock
+ * when we checked the flag earlier. No cause to panic, just return.
+ */
+ if (!(avc->f.states & FCSBypass))
+ goto done;
/* Ok, we actually do need to flush */
ObtainWriteLock(&afs_xcbhash, 957);
avc->cachingStates |= FCSManuallySet;
avc->cachingTransitions++;
+done:
ReleaseWriteLock(&avc->lock);
#ifdef AFS_BOZONLOCK_ENV
afs_BozonUnlock(&avc->pvnLock, avc);