summaryrefslogtreecommitdiffstats
path: root/source3/smbd/oplock.c
Commit message (Collapse)AuthorAgeFilesLines
* s3:smbd: Implementation of SMB2.1 and SMB3.0 leases.Volker Lendecke2014-12-041-31/+186
| | | | | | | | | Pair-Programmed-With: Jeremy Allison <jra@samba.org> Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:smbd: add lease related helper functions to oplock.cVolker Lendecke2014-12-041-0/+295
| | | | | | | | | Pair-Programmed-With: Jeremy Allison <jra@samba.org> Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:smbd: add fsp_lease_type() and get_lease_type() helper functionsVolker Lendecke2014-12-041-0/+30
| | | | | | | | These convert the oplock state into SMB2_LEASE_ flags. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:smbd: factor out a send_break_to_none() helper functionVolker Lendecke2014-12-041-16/+24
| | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:locking: convert brl_have_read field to brl_num_read.Volker Lendecke2014-11-111-45/+70
| | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:smbd: fix file corruption using "write cache size != 0"Stefan Metzmacher2014-11-061-0/+3
| | | | | | | | | | | | | | | | 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> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Nov 6 13:09:38 CET 2014 on sn-devel-104
* s3:smbd: use fsp->conn->sconn->client->connections to send SMB1 oplock breaksStefan Metzmacher2014-09-191-1/+6
| | | | | | | This means we use the first and only connection. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:smbd: pass smbXsrv_connection to srv_send_smb()Stefan Metzmacher2014-09-191-1/+2
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* Rename the profile enums with a SAMBA_ prefix to avoid conflict with system ↵Jeremy Allison2013-11-221-1/+1
| | | | | | | | | files. WRITE_FLUSH is defined in fs.h in Linux. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
* smbd: Fix DEBUG in do_break_to_noneVolker Lendecke2013-11-111-8/+6
| | | | | | | | | The name of this function has changed, but the DEBUG statements have not been adapted. This is the case in a lot of our code. With __func__ this problem goes away: __func__ is C99, and we also use it already. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* smbd: Remove separate oplock_type parameter from set_file_oplockVolker Lendecke2013-10-241-4/+3
| | | | | | | | This avoids the question where it could happen that something else but fsp->oplock_type might be useful as an argument here. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
* smbd: Make release_file_oplock staticVolker Lendecke2013-10-241-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
* smbd: Remove MSG_SMB_ASYNC_LEVEL2_BREAKVolker Lendecke2013-10-231-84/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Use MSG_SMB_BREAK_REQUEST for async l2 breaksVolker Lendecke2013-10-231-2/+10
| | | | | | | | | Now that we transmit the level we want to break to via the msg.op_type we can unify MSG_SMB_BREAK_REQUEST and MSG_SMB_ASYNC_LEVEL2_BREAK and thus simplify the code a bit. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Fix raw.batch.exclusive[59]Volker Lendecke2013-10-231-4/+6
| | | | | | | | | | | | | | | The level we have to break to depend on the breakers create_disposition: If we overwrite, we have to break to none. This patch overloads the "op_type" field in the break message we send across to the smbd holding the oplock with the oplock level we want to break to. Because it depends on the create_disposition in the breaking open, only the breaker can make that decision. We might want to use a different mechanism for this in the future, but for now using the op_type field seems acceptable to me. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Inline break_level2_to_none_asyncVolker Lendecke2013-10-151-38/+32
| | | | | | | | | | | | | With the special case for bug 5980 in do_break_to_none we only have one caller: process_oplock_async_level2_break_message. The further goal is to merge process_oplock_async_level2_break_message with process_oplock_break_message. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Oct 15 03:42:53 CEST 2013 on sn-devel-104
* smbd: Remove a special case for level2 breakVolker Lendecke2013-10-151-33/+12
| | | | | | | | With the level2 indicator in brlock.tdb this race condition does not exist anymore Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Remove some FAKE_LEVEL_II commentsVolker Lendecke2013-10-151-3/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Add debugs to brlock.cVolker Lendecke2013-10-151-0/+6
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Remove FAKE_LEVEL_II_OPLOCKVolker Lendecke2013-10-151-17/+60
| | | | | | | | | FAKE_LEVEL_II_OPLOCK was an indicator to break level2 oplock holders on write. This information is now being held in brlock.tdb, which makes the FAKE_LEVEL_II_OPLOCK type unnecessary. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Convert some dbgtxt to DEBUGVolker Lendecke2013-10-061-19/+12
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Fix a commentVolker Lendecke2013-10-061-1/+1
| | | | | | | | This has been converted from a timed event to an immediate one in e7dab403c0ca6f6 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Fix confusing commentsVolker Lendecke2013-10-061-2/+1
| | | | | | | The brlock-check is done in grant_fsp_oplock_type Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Slightly simplify do_break_to_noneVolker Lendecke2013-09-061-2/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* smbd: Apply some const to message_to_share_mode_entryVolker Lendecke2013-09-061-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* smbd: Remove unused should_notify_deferred_opensVolker Lendecke2013-09-061-10/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* smbd: Remove FORCE_OPLOCK_BREAK_TO_NONEVolker Lendecke2013-09-061-1/+0
| | | | | | | | | | | | | | | This flag existed to break an exclusive or batch oplock in just one instead of two steps down to "no oplock" when we did an allocation or file size change. Running raw.oplock against W2k12 differs in this respect from W2k3: W2k12 takes two steps (via level2) to break to none. This removes the special flag that we only had for compatibility with systems older than W2k12... Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Sep 6 00:47:07 CEST 2013 on sn-devel-104
* smbd: Add a paranoia check to oplock_timeout_handlerVolker Lendecke2013-09-041-0/+2
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Sep 4 22:36:24 CEST 2013 on sn-devel-104
* smbd: Fix an ancient oplock bugVolker Lendecke2013-09-041-0/+2
| | | | | | | | | | | If we get an oplock break response, we forgot to remove the oplock break timeout. Found by stopping raw.oplock.exclusive5 after the 2nd open and watching a debug level 10 log. This amends 08a9de89 from 2007. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Simplify new_break_message_smb1Volker Lendecke2013-08-201-18/+7
| | | | | | | | | | | There's no point in allocating a fixed length array that we throw away immediately after use. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Tue Aug 20 14:35:21 CEST 2013 on sn-devel-104
* smbd: Replace a 0-timeout wakeup_sendVolker Lendecke2013-08-201-17/+13
| | | | | | | A tevent_immediate is simpler and is what we want here. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* smbd: Do not wait unnecessarilyVolker Lendecke2013-08-161-1/+1
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Fri Aug 16 18:46:36 CEST 2013 on sn-devel-104
* smbd: Make break_level2_to_none_async staticVolker Lendecke2013-08-161-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* smbd: Obsolete MSG_SMB_OPEN_RETRYVolker Lendecke2013-04-261-36/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Remove the unused fsp->pending_break_messages arrayVolker Lendecke2013-04-261-11/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Remove unused reply_to_oplock_break_requestsVolker Lendecke2013-04-261-21/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Obsolete MSG_SMB_BREAK_RESPONSEVolker Lendecke2013-04-261-62/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Ignore OPEN_RETRY and BREAK_RESPONSEVolker Lendecke2013-04-261-0/+4
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:smbd: fix missing space in debug message in initial_break_processing()Michael Adam2013-02-281-1/+1
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:smbd: s/struct timed_event/struct tevent_timerStefan Metzmacher2013-02-191-1/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:smbd: s/struct event_context/struct tevent_contextStefan Metzmacher2013-02-191-1/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:util: rename procid_equal() to serverid_equal()Michael Adam2012-06-211-2/+2
| | | | Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:smbd: change oplock.c to use fsp_fnum_dbg() for fsp->fnum logging.Michael Adam2012-06-151-5/+5
| | | | Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:smbd: change set_file_oplock() to return NTSTATUSMichael Adam2012-06-081-5/+6
| | | | | | | | Pair-Programmed-With: Volker Lendecke <vl@samba.org> Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Fri Jun 8 23:20:20 CEST 2012 on sn-devel-104
* s3:smbd/oplock: avoid procid_is_me()Stefan Metzmacher2012-06-031-2/+4
| | | | metze
* s3:smbd: move global koplocks to smbd_server_connectionStefan Metzmacher2012-05-251-0/+19
| | | | metze
* s3:smbd: pass smbd_server_connection to should_notify_deferred_opens()Stefan Metzmacher2012-05-251-1/+1
| | | | metze
* s3:smbd: move global oplocks vars to smbd_server_connectionStefan Metzmacher2012-05-251-10/+15
| | | | metze
* s3:smbd: remove unused get_number_of_exclusive_open_oplocks()Stefan Metzmacher2012-05-251-9/+0
| | | | metze
* s3:onefs: remove all onefs related code as it not maintained anymoreStefan Metzmacher2012-05-161-3/+0
| | | | | | | | | | See https://lists.samba.org/archive/samba-technical/2012-May/083631.html for the discussion. metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Wed May 16 11:23:05 CEST 2012 on sn-devel-104