summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-10-03 18:10:59 +0000
committerJeremy Allison <jra@samba.org>2002-10-03 18:10:59 +0000
commita4f7b7bec191c1603f004a14d5b8b49e99305f48 (patch)
tree819a6b15040068748ee022a94ed7517cbaec8587 /source3/smbd
parentab8b6bd10b8729900c30b30db55e9239aa03f7cf (diff)
downloadsamba-a4f7b7bec191c1603f004a14d5b8b49e99305f48.tar.gz
samba-a4f7b7bec191c1603f004a14d5b8b49e99305f48.tar.bz2
samba-a4f7b7bec191c1603f004a14d5b8b49e99305f48.zip
Write cache bugfix from Rasmus Borup Hansen, system adm. Email: rbh@math.ku.dk
Jeremy. (This used to be commit d40a14dbb0ec233f7a2190df1845b039072c4b84)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/fileio.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c
index 89f05092b4..a29336d3a2 100644
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -440,6 +440,19 @@ len = %u\n",fsp->fd, (double)pos, (unsigned int)n, (double)wcp->offset, (unsigne
} else {
ssize_t ret = real_write_file(fsp, data, pos, n);
+ /*
+ * If the write overlaps the entire cache, then
+ * discard the current contents of the cache.
+ * Fix from Rasmus Borup Hansen rbh@math.ku.dk.
+ */
+
+ if ((pos <= wcp->offset) &&
+ (pos + n >= wcp->offset + wcp->data_size) ) {
+ DEBUG(9,("write_file: discarding overwritten write \
+cache: fd = %d, off=%.0f, size=%u\n", fsp->fd, (double)wcp->offset, (unsigned int)wcp->data_size ));
+ wcp->data_size = 0;
+ }
+
DO_PROFILE_INC(writecache_direct_writes);
if (ret == -1)
return ret;