mirror of
https://git.openafs.org/openafs.git
synced 2025-01-20 16:00:12 +00:00
dir-hold-afs-bufferlock-across-increment-of-buffer-lockers-to-prevent-newslot-from-walking-on-stuff-20020514
liberal debugging code and hammering produced a failure where newslot was actually walking on another call to newslot because the bufferlock was being dropped before newslot incremented lockers on the buffer it was allocating, allowing someone else to come along and also think they could allocate it. by holding the bufferlock just a little longer we avoid this
This commit is contained in:
parent
50473f885f
commit
0eb68f307a
@ -132,8 +132,8 @@ char *DRead(fid,page)
|
|||||||
if ( tb = phTable[pHash(fid)] ) { /* ASSMT HERE */
|
if ( tb = phTable[pHash(fid)] ) { /* ASSMT HERE */
|
||||||
if (bufmatch(tb)) {
|
if (bufmatch(tb)) {
|
||||||
ObtainWriteLock(&tb->lock);
|
ObtainWriteLock(&tb->lock);
|
||||||
ReleaseWriteLock(&afs_bufferLock);
|
|
||||||
tb->lockers++;
|
tb->lockers++;
|
||||||
|
ReleaseWriteLock(&afs_bufferLock);
|
||||||
tb->accesstime = ++timecounter;
|
tb->accesstime = ++timecounter;
|
||||||
ReleaseWriteLock(&tb->lock);
|
ReleaseWriteLock(&tb->lock);
|
||||||
return tb->data;
|
return tb->data;
|
||||||
@ -144,8 +144,8 @@ char *DRead(fid,page)
|
|||||||
if (bufmatch(tb2)) {
|
if (bufmatch(tb2)) {
|
||||||
buf_Front(bufhead,tb,tb2);
|
buf_Front(bufhead,tb,tb2);
|
||||||
ObtainWriteLock(&tb2->lock);
|
ObtainWriteLock(&tb2->lock);
|
||||||
ReleaseWriteLock(&afs_bufferLock);
|
|
||||||
tb2->lockers++;
|
tb2->lockers++;
|
||||||
|
ReleaseWriteLock(&afs_bufferLock);
|
||||||
tb2->accesstime = ++timecounter;
|
tb2->accesstime = ++timecounter;
|
||||||
ReleaseWriteLock(&tb2->lock);
|
ReleaseWriteLock(&tb2->lock);
|
||||||
return tb2->data;
|
return tb2->data;
|
||||||
@ -154,8 +154,8 @@ char *DRead(fid,page)
|
|||||||
if (bufmatch(tb)) {
|
if (bufmatch(tb)) {
|
||||||
buf_Front(bufhead,tb2,tb);
|
buf_Front(bufhead,tb2,tb);
|
||||||
ObtainWriteLock(&tb->lock);
|
ObtainWriteLock(&tb->lock);
|
||||||
ReleaseWriteLock(&afs_bufferLock);
|
|
||||||
tb->lockers++;
|
tb->lockers++;
|
||||||
|
ReleaseWriteLock(&afs_bufferLock);
|
||||||
tb->accesstime = ++timecounter;
|
tb->accesstime = ++timecounter;
|
||||||
ReleaseWriteLock(&tb->lock);
|
ReleaseWriteLock(&tb->lock);
|
||||||
return tb->data;
|
return tb->data;
|
||||||
@ -175,8 +175,8 @@ char *DRead(fid,page)
|
|||||||
tb = newslot(fid, page, (tb ? tb : tb2));
|
tb = newslot(fid, page, (tb ? tb : tb2));
|
||||||
ios++;
|
ios++;
|
||||||
ObtainWriteLock(&tb->lock);
|
ObtainWriteLock(&tb->lock);
|
||||||
ReleaseWriteLock(&afs_bufferLock);
|
|
||||||
tb->lockers++;
|
tb->lockers++;
|
||||||
|
ReleaseWriteLock(&afs_bufferLock);
|
||||||
if (ReallyRead(tb->fid,tb->page,tb->data)) {
|
if (ReallyRead(tb->fid,tb->page,tb->data)) {
|
||||||
tb->lockers--;
|
tb->lockers--;
|
||||||
FidZap(tb->fid); /* disaster */
|
FidZap(tb->fid); /* disaster */
|
||||||
@ -399,8 +399,8 @@ char *DNew (fid,page)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ObtainWriteLock(&tb->lock);
|
ObtainWriteLock(&tb->lock);
|
||||||
ReleaseWriteLock(&afs_bufferLock);
|
|
||||||
tb->lockers++;
|
tb->lockers++;
|
||||||
|
ReleaseWriteLock(&afs_bufferLock);
|
||||||
ReleaseWriteLock(&tb->lock);
|
ReleaseWriteLock(&tb->lock);
|
||||||
return tb->data;
|
return tb->data;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user