struct dcache *tdc;
struct osi_file *tfile;
afs_size_t offset, len;
+ int code = 0;
tdc = afs_GetDCache(avc, 0, areq, &offset, &len, 0);
if (!tdc) {
avc->f.m.Length = len;
ObtainWriteLock(&tdc->lock, 720);
+ tfile = afs_CFileOpen(&tdc->f.inode);
+ if (!tfile) {
+ code = EIO;
+ goto done;
+ }
afs_AdjustSize(tdc, len);
tdc->validPos = len;
- tfile = afs_CFileOpen(&tdc->f.inode);
afs_CFileWrite(tfile, 0, aname, len);
afs_CFileClose(tfile);
+ done:
ReleaseWriteLock(&tdc->lock);
- return 0;
+ return code;
}
/* don't set CDirty in here because RPC is called synchronously */
ObtainWriteLock(&afs_xvcache, 40);
if (code) {
if (code < 0) {
- ObtainWriteLock(&afs_xcbhash, 499);
- afs_DequeueCallback(adp);
- adp->f.states &= ~CStatd;
- ReleaseWriteLock(&afs_xcbhash);
- osi_dnlc_purgedp(adp);
+ afs_StaleVCache(adp);
}
ReleaseWriteLock(&adp->lock);
ReleaseWriteLock(&afs_xvcache);