{
char temp[MOUNTPOINTLEN];
osi_hyper_t offset;
+ afs_uint32 bytesRead = 0;
/* otherwise, we have to read it in */
offset.LowPart = offset.HighPart = 0;
- code = cm_GetData(scp, &offset, temp, MOUNTPOINTLEN, userp, reqp);
+ code = cm_GetData(scp, &offset, temp, MOUNTPOINTLEN, &bytesRead, userp, reqp);
if (code)
goto done;
if (code == 0) {
lock_ObtainWrite(&scp->rw);
if (--scp->linkCount == 0) {
- scp->flags |= CM_SCACHEFLAG_DELETED;
+ _InterlockedOr(&scp->flags, CM_SCACHEFLAG_DELETED);
lock_ObtainWrite(&cm_scacheLock);
cm_AdjustScacheLRU(scp);
cm_RemoveSCacheFromHashTable(scp);
{
char temp[MOUNTPOINTLEN];
osi_hyper_t offset;
+ afs_uint32 bytesRead = 0;
/* read the link data from the file server */
offset.LowPart = offset.HighPart = 0;
- code = cm_GetData(linkScp, &offset, temp, MOUNTPOINTLEN, userp, reqp);
+ code = cm_GetData(linkScp, &offset, temp, MOUNTPOINTLEN, &bytesRead, userp, reqp);
if (code)
return code;
* Dropping it is ok because we are holding scp->bufCreateLock
* which prevents the size of the file from changing.
*/
- lock_ReleaseWrite(&scp->rw);
- available = cm_IsSpaceAvailable(&scp->fid, sizep, userp, reqp);
- lock_ObtainWrite(&scp->rw);
+ afs_uint64 nextChunk = scp->length.QuadPart;
+
+ nextChunk -= (nextChunk & 0xFFFFF);
+ nextChunk += 0x100000;
+
+ if (sizep->QuadPart > nextChunk) {
+ lock_ReleaseWrite(&scp->rw);
+ available = cm_IsSpaceAvailable(&scp->fid, sizep, userp, reqp);
+ lock_ObtainWrite(&scp->rw);
+ } else {
+ /*
+ * The file server permits 1MB quota overruns so only check
+ * when the file size increases by at least that much.
+ */
+ available = 1;
+ }
if (available) {
scp->length = *sizep;
scp->mask |= CM_SCACHEMASK_LENGTH;
if (scp) {
if (code == 0) {
lock_ObtainWrite(&scp->rw);
- scp->flags |= CM_SCACHEFLAG_DELETED;
+ _InterlockedOr(&scp->flags, CM_SCACHEFLAG_DELETED);
lock_ObtainWrite(&cm_scacheLock);
cm_AdjustScacheLRU(scp);
cm_RemoveSCacheFromHashTable(scp);