int osi_UFSClose(struct osi_file *afile) { AFS_STATCNT(osi_Close); if (afile->vnode) { /* AIX writes entire data regions at a time when dumping core. We've * seen a 26M write go through the system. When this happens, we run * out of available pages. So, we'll flush the vnode's vm if we're short * on space. */ if (vmPageHog) { int code; if (afile->vnode->v_gnode->gn_seg) { /* 524287 is the max number of pages for a file. See test in * vm_writep. */ code = vm_writep(afile->vnode->v_gnode->gn_seg, 0, 524287); } } AFS_RELE(afile->vnode); } osi_FreeSmallSpace(afile); return 0; }
/* Try to store pages to cache, in order to store a file back to the server. * * Locking: the vcache entry's lock is held. It will usually be dropped and * re-obtained. */ void osi_VM_StoreAllSegments(struct vcache *avc) { if (avc->segid) { /* * The execsOrWriters test is done so that we don't thrash on * the vm_writep call below. We only initiate a pageout of the * dirty vm pages on the last store... * this is strictly a pragmatic decision, and _does_ break the * advertised AFS consistency semantics. Without this hack, * AIX systems panic under heavy load. I consider the current * behavior a bug introduced to hack around a worse bug. XXX * * Removed do_writep governing sync'ing behavior. */ ReleaseWriteLock(&avc->lock); /* XXX */ AFS_GUNLOCK(); vm_writep(avc->segid, 0, MAXFSIZE / PAGESIZE - 1); vms_iowait(avc->segid); AFS_GLOCK(); ObtainWriteLock(&avc->lock, 93); /* XXX */ /* * The following is necessary because of the following * asynchronicity: We open a file, write to it and * close the file * if CCore flag is set, we clear it and do the extra * decrement ourselves now. * If we're called by the CCore clearer, the CCore flag * will already be clear, so we don't have to worry about * clearing it twice. * avc was "VN_HELD" and "crheld" when CCore was set in * afs_FakeClose */ if (avc->f.states & CCore) { avc->f.states &= ~CCore; avc->opens--; avc->execsOrWriters--; AFS_RELE(AFSTOV(avc)); crfree((struct ucred *)avc->linkData); avc->linkData = NULL; } } }