LICENSE IPL10
FIXES 59136
in order that the writes to CacheItems not be addled, we need to *actually*
hold a *write* lock when we write. not even just read as the comment says.
and certainly not none as was happening in the dir package.
(cherry picked from commit
c0a04c21cf36e4c8e25be9703f715f30d1bf55a6)
UpgradeSToWLock(&tdc->lock, 631);
if (afs_LocalHero(adp, tdc, &OutDirStatus, 1)) {
/* we can do it locally */
+ ObtainWriteLock(&afs_xdcache, 291);
code = afs_dir_Create(tdc, aname, &newFid.Fid);
+ ReleaseWriteLock(&afs_xdcache);
if (code) {
ZapDCE(tdc);
DZap(tdc);
ObtainWriteLock(&tdc->lock, 632);
if (afs_LocalHero(adp, tdc, &OutDirStatus, 1)) {
/* we can do it locally */
+ ObtainWriteLock(&afs_xdcache, 294);
code = afs_dir_Create(tdc, aname, &newFid.Fid);
+ ReleaseWriteLock(&afs_xdcache);
if (code) {
ZapDCE(tdc); /* surprise error -- use invalid value */
DZap(tdc);
ObtainWriteLock(&tdc->lock, 635);
if (afs_LocalHero(adp, tdc, &OutDirStatus, 1)) {
/* we can do it locally */
+ ObtainWriteLock(&afs_xdcache, 290);
code = afs_dir_Create(tdc, aname, &avc->fid.Fid);
+ ReleaseWriteLock(&afs_xdcache);
if (code) {
ZapDCE(tdc); /* surprise error -- invalid value */
DZap(tdc);
code = afs_dir_Delete(tdc2, aname2);
}
if (code == 0) {
+ ObtainWriteLock(&afs_xdcache, 292);
code = afs_dir_Create(tdc2, aname2, &fileFid.Fid);
+ ReleaseWriteLock(&afs_xdcache);
}
if (code != 0) {
ZapDCE(tdc1);
/* otherwise, we should see if we can make the change to the dir locally */
if (afs_LocalHero(adp, tdc, &OutDirStatus, 1)) {
/* we can do it locally */
+ ObtainWriteLock(&afs_xdcache, 293);
code = afs_dir_Create(tdc, aname, &newFid.Fid);
+ ReleaseWriteLock(&afs_xdcache);
if (code) {
ZapDCE(tdc); /* surprise error -- use invalid value */
DZap(tdc);
if (cacheDiskType == AFS_FCACHE_TYPE_MEM)
return 0;
AFS_STATCNT(afs_WriteDCache);
+ osi_Assert(WriteLocked(&afs_xdcache));
if (atime)
adc->f.modTime = osi_Time();
/*