mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 13:38:01 +00:00
DEVEL15-writedcache-enforce-xdcache-writelock-20071208
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)
This commit is contained in:
parent
5386bfa163
commit
8f98479170
@ -353,7 +353,9 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
|
||||
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);
|
||||
|
@ -132,7 +132,9 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
|
||||
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);
|
||||
|
@ -127,7 +127,9 @@ afs_link(avc, OSI_VC_ARG(adp), aname, acred)
|
||||
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);
|
||||
|
@ -227,7 +227,9 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp,
|
||||
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);
|
||||
|
@ -177,7 +177,9 @@ int afs_symlink
|
||||
/* 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);
|
||||
|
@ -3073,6 +3073,7 @@ afs_WriteDCache(register struct dcache *adc, int atime)
|
||||
if (cacheDiskType == AFS_FCACHE_TYPE_MEM)
|
||||
return 0;
|
||||
AFS_STATCNT(afs_WriteDCache);
|
||||
osi_Assert(WriteLocked(&afs_xdcache));
|
||||
if (atime)
|
||||
adc->f.modTime = osi_Time();
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user