overquota and diskfull errors are detected while writing dirty buffers
to the file server. A flag is set on the scp so that the error can
be returned to the caller. cm_FSync was clearing the flag without
returning the error. This permitted calls to Win32 WriteFile to report
success even when they failed.
lock_ReleaseWrite(&scp->bufCreateLock);
if (code == 0) {
lock_ObtainMutex(&scp->mx);
- scp->flags &= ~(CM_SCACHEFLAG_OVERQUOTA
- | CM_SCACHEFLAG_OUTOFSPACE);
+
if (scp->mask & (CM_SCACHEMASK_TRUNCPOS
| CM_SCACHEMASK_CLIENTMODTIME
| CM_SCACHEMASK_LENGTH))
code = cm_StoreMini(scp, userp, reqp);
+
+ if (scp->flags & (CM_SCACHEFLAG_OVERQUOTA | CM_SCACHEFLAG_OUTOFSPACE)) {
+ code = (scp->flags & CM_SCACHEFLAG_OVERQUOTA) ? CM_ERROR_QUOTA : CM_ERROR_SPACE;
+ scp->flags &= ~(CM_SCACHEFLAG_OVERQUOTA | CM_SCACHEFLAG_OUTOFSPACE);
+ }
+
lock_ReleaseMutex(&scp->mx);
}
return code;