svn commit: samba r6949 - in branches/SAMBA_3_0/source/smbd: .
jra at samba.org
jra at samba.org
Tue May 24 04:55:19 GMT 2005
Author: jra
Date: 2005-05-24 04:55:18 +0000 (Tue, 24 May 2005)
New Revision: 6949
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6949
Log:
Back-port Volker's cache fix, plus my change.
Jeremy.
Modified:
branches/SAMBA_3_0/source/smbd/fileio.c
Changeset:
Modified: branches/SAMBA_3_0/source/smbd/fileio.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/fileio.c 2005-05-24 01:31:04 UTC (rev 6948)
+++ branches/SAMBA_3_0/source/smbd/fileio.c 2005-05-24 04:55:18 UTC (rev 6949)
@@ -509,6 +509,44 @@
write_path = 3;
+ } else if ( (pos >= wcp->file_size) &&
+ (n == 1) &&
+ (pos < wcp->offset + 2*wcp->alloc_size) &&
+ (wcp->file_size == wcp->offset + wcp->data_size)) {
+
+ /*
+ +---------------+
+ | Cached data |
+ +---------------+
+
+ +--------+
+ | 1 Byte |
+ +--------+
+
+ MS-Office seems to do this a lot to determine if there's enough
+ space on the filesystem to write a new file.
+ */
+
+ SMB_BIG_UINT new_start = wcp->offset + wcp->data_size;
+
+ flush_write_cache(fsp, WRITE_FLUSH);
+ wcp->offset = new_start;
+ wcp->data_size = pos - new_start + 1;
+ memset(wcp->data, '\0', wcp->data_size);
+ memcpy(wcp->data + wcp->data_size-1, data, 1);
+
+ /*
+ * Update the file size if changed.
+ */
+
+ if (wcp->offset + wcp->data_size > wcp->file_size) {
+ if (wcp_file_size_change(fsp) == -1) {
+ return -1;
+ }
+ }
+
+ return n;
+
} else {
/* ASCII art..... JRA.
More information about the samba-cvs
mailing list