Windows: Protect buffers in smb_WriteData from simultaneous writes
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 11 Jan 2010 19:21:11 +0000 (14:21 -0500)
committerJeffrey Altman <jaltman|account-1000011@unknown>
Wed, 13 Jan 2010 07:05:15 +0000 (23:05 -0800)
commit6789f170d64695907970f01c22ac6eb8c7b14d15
treeded08e828481ba70043de86e96926e5851f2dcad
parent513a7e48a2e586bd687af75084cfdf955f37b42f
Windows: Protect buffers in smb_WriteData from simultaneous writes

smb_WriteData does not properly use CM_SCACHESYNC_WRITE to
protect buffers from simultaneous writes.  Instead of simply
testing CM_SCACHESYNC_WRITE at the top of the while loop,
the flag must remain set until the entire write completes.
cm_SyncOp is now called once and cm_SyncOpDone is only called
upon final success or error.

In addition, as 'count' is unsigned, the test for count < 0
is replaced with count != 0.

LICENSE MIT

Change-Id: I82c8dc20e62079b13bf305e906f4744756aa0ac2
Reviewed-on: http://gerrit.openafs.org/1087
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
src/WINNT/afsd/smb.c