Windows: Check Avail Space on extending SetEndOfFile
authorJeffrey Altman <jaltman@your-file-system.com>
Fri, 6 Apr 2012 03:14:18 +0000 (23:14 -0400)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 6 Apr 2012 13:16:58 +0000 (06:16 -0700)
commit3d024372293a279cf3a6cbdfe75a384ec7c8b200
treeb7127165528a8dc4c9fbd4376dc8e814fd963978
parent613f14727fbb404fb7fc1cac953dda46b671222e
Windows: Check Avail Space on extending SetEndOfFile

When cm_SetLength() is called with an extending file length,
check the available free space in the volume to see if the
new length will fit.  If not, return CM_ERROR_SPACE.

This permits applications to discover that there is insufficient
space prior to writing all of the data into the windows page
cache at which point it will be too late.

There is still the possibility of a race that can result in
data loss if two applications are writing into the same volume
at the same time and there is insufficient room.

Change-Id: Ieef2c48f5b6edc8d101b6527af3a3f87fe55f6ca
Reviewed-on: http://gerrit.openafs.org/7057
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
src/WINNT/afsd/cm_vnodeops.c
src/WINNT/afsd/cm_vnodeops.h