summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-11-07 15:57:40 -0800
committerKarolin Seeger <kseeger@samba.org>2014-11-09 22:51:19 +0100
commit7e486b942c7e5cd923bb9ced6b7bc9649bc7100e (patch)
treeab977dbfdf649c3b59d56af61e9cbe24fdd67bec /source3
parent1b0da1d8bac7e8dfb52e723a7753b75ce8053a9c (diff)
downloadsamba-7e486b942c7e5cd923bb9ced6b7bc9649bc7100e.tar.gz
s3:smbd: fix file corruption using "write cache size != 0"
A client can: - open a handle (h1) - write some data to h1. - open a 2nd handle h2 (downgrades both handles to level II) - try to read the data on h2 (this gets old data) Bug: https://bugzilla.samba.org/show_bug.cgi?id=10921 Signed-off-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-0-test): Sun Nov 9 22:51:19 CET 2014 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/oplock.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 95d88ef3813..045fd46967d 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -151,6 +151,9 @@ static void downgrade_file_oplock(files_struct *fsp)
sconn->oplocks.level_II_open++;
fsp->sent_oplock_break = NO_BREAK_SENT;
+ flush_write_cache(fsp, OPLOCK_RELEASE_FLUSH);
+ delete_write_cache(fsp);
+
TALLOC_FREE(fsp->oplock_timeout);
}