summaryrefslogtreecommitdiff
path: root/source3/locking/proto.h
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-09-11 12:48:14 +0000
committerJeremy Allison <jra@samba.org>2013-10-15 01:52:29 +0200
commiteb50c18c4a2d0caa3b8d21b2e1b536adc8dc0276 (patch)
tree508858b344654e4f59ecfff0c8977b58f05e438e /source3/locking/proto.h
parent54019ca9aaf9d200c60e8d234259c439875c85f7 (diff)
downloadsamba-eb50c18c4a2d0caa3b8d21b2e1b536adc8dc0276.tar.gz
samba-eb50c18c4a2d0caa3b8d21b2e1b536adc8dc0276.tar.bz2
samba-eb50c18c4a2d0caa3b8d21b2e1b536adc8dc0276.zip
smbd: Put "have_read_oplocks" into brlock.tdb
This implements an idea by metze: Right now Samba does not grant level2 oplocks where it should: After an initial no-oplock open that has been written to, we don't have the FAKE_LEVEL2_OPLOCK entry in locking.tdb around anymore, this downgraded to NO_OPLOCK. Windows in this case will grant level2 if being asked, we don't. Part of the reason for this is that we don't have a proper mechanism to communicate the fact that level2 needs to be broken to other smbds. Metze's insight was that we have to look into brlock.tdb for every write anyway, so this might be the right place to store this information. My first reaction was that this is really hackish, but on further thought this is not. oplocks depend on brlocks anyway, and we have the proper mechanisms in place for brlocks. The format for this change is to add one byte to the end of the brlock.tdb record with value 1 if we have level2 oplocks around. Thus this patch effectively reverts 8f41142 which I discovered while writing this change. We now legally have unaligned records. We can certainly talk about the format, but I'm not yet convinced we need an idl for this yet. This is a potentially very hot code path, and ndr marshalling has a cost. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/locking/proto.h')
-rw-r--r--source3/locking/proto.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/source3/locking/proto.h b/source3/locking/proto.h
index 02e2bf5307..f6ae462bac 100644
--- a/source3/locking/proto.h
+++ b/source3/locking/proto.h
@@ -30,6 +30,9 @@ void brl_shutdown(void);
unsigned int brl_num_locks(const struct byte_range_lock *brl);
struct files_struct *brl_fsp(struct byte_range_lock *brl);
+bool brl_have_read_oplocks(const struct byte_range_lock *brl);
+void brl_set_have_read_oplocks(struct byte_range_lock *brl,
+ bool have_read_oplocks);
NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
struct lock_struct *plock,