1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

127 Commits

Author SHA1 Message Date
Volker Lendecke
f856fb0b35 s3: Explicitly pass sconn to remove_pending_lock_requests_by_mid_smb1 2010-06-12 15:42:56 +02:00
Volker Lendecke
91bd52da1a s3: Remove smbd_server_conn from cancel_pending_lock_requests_by_fid 2010-06-12 15:42:56 +02:00
Volker Lendecke
034e616448 s3: Remove smbd_server_conn from push_blocking_lock_request 2010-06-12 15:42:56 +02:00
Volker Lendecke
bfd5f24fa1 s3: Remove smbd_server_conn from brl_timeout_fn 2010-06-12 15:42:56 +02:00
Jeremy Allison
d28fa8faab Rename "allow_smb2" -> "using_smb2" and make the usage clearer. 2010-06-09 19:12:02 -07:00
Jeremy Allison
adf4833792 This patch looks bigger than it is. It does 2 things. 1). Renames smbpid -> smblctx in our locking code. 2). Widens smblctx to 64-bits internally. Preparing to use the SMB2 handle as the locking context.
Jeremy.
2010-05-07 06:20:50 -07:00
Jeremy Allison
4ad1943d29 Make us pass all SMB2 lock tests except MULTIPLE-UNLOCK and CONTEXT. Them next :-).
Jeremy.
2010-05-07 01:20:26 -07:00
Jeremy Allison
a77a8a5e35 Fix more SMB2 locking. We still crash but this won't last :-).
Jeremy.
2010-05-06 08:22:13 -07:00
Günther Deschner
c6ebab846d s3: only include gen_ndr headers where needed.
This shrinks include/includes.h.gch by the size of 7 MB and reduces build time
as follows:

ccache build w/o patch
real    4m21.529s
ccache build with patch
real    3m6.402s

pch build w/o patch
real    4m26.318s
pch build with patch
real    3m6.932s

Guenther
2010-05-06 00:22:59 +02:00
Jeremy Allison
62143543ce Fixed issue with return in a void function found by Björn JACKE <bj@SerNet.DE>
Jeremy.
2010-05-05 06:09:03 -07:00
Jeremy Allison
f4092ecec7 Plumb the SMB2 front end into the blocking lock backend.
Metze, you'll probably be happier with this work as it
doesn't abuse tevent in the way you dislike. This is a
first cut at the code, which will need lots of testing
but I'm hoping this will give people an idea of where I'm
going with this.

Jeremy.
2010-04-30 21:03:20 -07:00
Jeremy Allison
e90444319c Carefully label SMB1-specific locking calls.
Jeremy.
2010-04-29 17:08:12 -07:00
Jeremy Allison
ebf6340bb5 Move the global blocking lock records into the smb1 state.
Jeremy
2010-04-29 16:50:15 -07:00
Jeremy Allison
7984243768 Move to using 64-bit mid values in our internal open file database.
This will allow us to share logic much easier between SMB1 and SMB2
servers.

Jeremy
2010-04-12 21:40:28 -07:00
Jeremy Allison
e15939b456 Plumb SMB2 stubs into all the places we defer SMB1 operations.
Rename functions to be internally consistent. Next step is
to cope queueing single (non-compounded) SMB2 requests to
put some code inside the stubs.

Jeremy.
2010-04-09 19:26:34 -07:00
Jeremy Allison
08b24e923d Stop smb2 from calling into smb1 blocking lock request code.
Allocate a uint16_t internal SMB1 mid for an SMB2 request.
Add a back pointer from the faked up smb_request struct
to the smb2 request.

Getting ready to add restart code for blocking locks,
share mode violations and oplocks in SMB2.

Jeremy.
2010-04-08 22:15:55 -07:00
Steven Danneman
cb0ea27369 s3/smbd: change locking behavior when "lock spin time = 0".
The "lock spin time" parameter mimics the following Windows
setting which by default is 250ms in Windows and 200ms in Samba.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\LockViolationDelay

When a client sends repeated, non-blocking, contending BRL requests
to a Windows server, after the first Windows starts treating these
requests as timed blocking locks with the above timeout.

As an efficiency, I've changed the behavior when this setting is 0,
to skip this logic and treat all requests as non-blocking locks.

This gives the smbd server behavior similar to the 3.0 release with
the do_spin_lock() implementation.

I've also changed the blocking lock parameter in the call from
push_blocking_lock_request() to true as all requests made in this
path are blocking by definition.
2010-02-12 21:29:00 -08:00
Jeremy Allison
b93f07ef41 Fix trailing whitespace errors I added (sorry).
Jeremy.
2010-02-05 22:51:11 -08:00
Andrew Tridgell
5b398edbee s3-brlock: add a minimim retry time for pending blocking locks
When we are waiting on a pending byte range lock, another smbd might
exit uncleanly, and therefore not notify us of the removal of the
lock, and thus not trigger the lock to be retried.

We coped with this up to now by adding a message_send_all() in the
SIGCHLD and cluster reconfigure handlers to send a MSG_SMB_UNLOCK to
all smbd processes. That would generate O(N^2) work when a large
number of clients disconnected at once (such as on a network outage),
which could leave the whole system unusable for a very long time (many
minutes, or even longer).

By adding a minimum re-check time for pending byte range locks we
avoid this problem by ensuring that pending locks are retried at a
more regular interval.
2010-02-05 22:17:17 -08:00
Jeremy Allison
9a2112ec66 Second part of the fix for bug 6828 - infinite timeout occurs when byte lock held outside of samba.
Fixes case where a connection with a pending lock can me marked "idle", and ensures
that the lock queue timeout is always recalculated.
Jeremy.
2009-10-26 21:20:22 -07:00
Jeremy Allison
bb7cf9ad23 Fix bug 6828 - infinite timeout occurs when byte lock held outside of samba
Jeremy.
2009-10-20 17:52:34 -07:00
Tim Prouty
5a8d70d465 s3: Change fsp->fsp_name to be an smb_filename struct! 2009-07-20 17:26:56 -07:00
Stefan Metzmacher
c16c90a1cb s3:smbd: use new simplified snb_signing code in the server
We keep the seqnum/mid mapping in the smb_request structure.

This also moves one global variable into the
smbd_server_connection struct.

metze
2009-03-23 12:21:13 +01:00
Zack Kirsch
813273c87e Add VFS ops for Windows BRL: Lock, Unlock and Cancel:
This patch adds 3 new VFS OPs for Windows byte range locking: BRL_LOCK_WINDOWS,
BRL_UNLOCK_WINDOWS and BRL_CANCEL_WINDOWS. Specifically:

* I renamed brl_lock_windows, brl_unlock_windows and brl_lock_cancel to
  *_default as the default implementations of the VFS ops.
* The blocking_lock_record (BLR) is now passed into the brl_lock_windows and
  brl_cancel_windows paths. The Onefs implementation uses it - future
  implementations may find it useful too.
* Created brl_lock_cancel to do what brl_lock/brl_unlock do: set up a
  lock_struct and call either the Posix or Windows lock function. These happen
  to be the same for the default implementation.
* Added helper functions: increment_current_lock_count() and
  decrement_current_lock_count().
* Minor spelling correction in brl_timeout_fn: brl -> blr.
* Changed blocking_lock_cancel() to return the BLR that it has cancelled. This
  allows us to assert its the lock that we wanted to cancel. If this assert ever
  fires, this path will need to take in the BLR to cancel, rather than choosing
  on its own.
* Adds a small helper function: find_blocking_lock_record_by_id(). Used by the
  OneFS implementation, but could be useful for others.
2009-02-13 10:08:40 -08:00
Zack Kirsch
eb3d964f20 Remove typedef struct blocking_lock_record and move references to struct blocking_lock_record. 2009-02-13 10:08:27 -08:00
todd stecher
54c51a66e3 S3: New module interface for SMB message statistics gathering
This changelist allows for the addition of custom performance
monitoring modules through smb.conf. Entrypoints in the main message
processing code have been added to capture the command, subop, ioctl,
identity and message size statistics.
2009-02-09 13:23:44 -08:00
Volker Lendecke
d94e9c802c Remove the global variable "chain_size" 2009-01-31 11:09:39 +01:00
Volker Lendecke
ba981128ac Add a new implementation of chain_reply
This the global variable "orig_inbuf" in the old chain_reply code. This global
variable was one of the reasons why we had the silly restriction to not allow
async requests within a request chain.
2009-01-16 13:00:28 +01:00
Stefan Metzmacher
3dde0cbb76 s3:smbd: move all globals and static variables in globals.[ch]
The goal is to move all this variables into a big context structure.

metze
2009-01-08 12:22:21 +01:00
Stefan Metzmacher
c34d5f445a s3:events: change event_add_timed() prototype to match samba4
metze
2009-01-05 15:07:35 +01:00
Volker Lendecke
8315677ca3 Do not write into inbuf for the transs request
Instead, fix up the outbuf in send_xx_reply. In those routines, we know
what we are returning.
2008-11-08 10:42:29 +01:00
Volker Lendecke
5e2956557b Remove the change to the user context in process_blocking_lock_queue() 2008-11-08 10:42:28 +01:00
Volker Lendecke
6b4d48c4bf Convert blocking.c to store a smb_request instead of just inbuf 2008-11-04 20:52:07 +01:00
Volker Lendecke
d5f91d7a08 Simplify logic of cancel_pending_lock_requests_by_fid()
The only caller of this function is locking_close_file(). This checks itself if
brl_lock != NULL. The additional check is not necessary here.
2008-11-04 20:52:07 +01:00
Volker Lendecke
3376e7a6a0 Slightly simplify logic in process_lockingX()
The "else" is pointless here, we did a "return True" in the if branch.
2008-11-04 20:52:07 +01:00
Volker Lendecke
59e237cae5 Slightly simplify logic in remove_pending_lock_requests_by_mid()
Use "continue" for (SVAL(blr->inbuf,smb_mid) != mid)
2008-11-04 20:52:07 +01:00
Volker Lendecke
eddb43c713 Slightly simplify logic in cancel_pending_lock_requests_by_fid()
Use a "continue" for (blr->fsp->fnum != fsp->fnum)
2008-11-04 20:52:07 +01:00
Volker Lendecke
f0ba601c26 Convert blocking.c to use talloc 2008-11-04 20:52:06 +01:00
Volker Lendecke
b8125663d9 Make "inbuf" a talloc child of "smb_request" for normal smb requests
This is necessary if we want to keep the whole smb_request for deferred ops.
The explicit settings of req->inbuf will be removed once all those deferring
operations are converted to store the whole request and not just the inbuf.
2008-11-04 20:52:06 +01:00
Volker Lendecke
eb9656e757 Fix nonempty blank lines 2008-11-03 17:58:12 +01:00
Volker Lendecke
7808a2594c Remove some inbuf references by adding "cmd" to smb_request 2008-11-02 23:17:01 +01:00
Volker Lendecke
ab0561f3c3 Apply some const to get_lock_*() 2008-11-01 19:41:07 +01:00
Jelmer Vernooij
4746f79d50 Use {u,}int64_t instead of SMB_BIG_{U,}INT. 2008-10-14 01:59:36 +02:00
Volker Lendecke
d65afbe55f Remove the chain_fsp global 2008-10-13 19:32:39 +02:00
Volker Lendecke
5ddb2abf76 Some more talloc_tos()
(This used to be commit 444e35e7df)
2008-01-10 13:19:58 +01:00
Jeremy Allison
4a413e4bd1 Fix %d / size_t printf arg missmatch.
Jeremy.
(This used to be commit 3e3205309b)
2008-01-05 01:17:33 -08:00
Jeremy Allison
6503c7338e Fix interesting bug found with make valgrindtest. When cancelling
a lock due to file closure make sure we null out the fsp pointer
so it isn't dangling. This is an old bug (not related to the new
changes).
Jeremy.
(This used to be commit b5ee972b0c)
2008-01-04 13:59:26 -08:00
Jeremy Allison
9254bb4ef1 Refactor the crypto code after a very helpful conversation
with Volker. Mostly making sure we have data on the incoming
packet type, not stored in the smb header.
Jeremy.
(This used to be commit c4e5a50504)
2008-01-04 12:56:23 -08:00
Jeremy Allison
c3250149e1 Add new parameter, "min receivefile size" (by default set
to zero). If non-zero, writeX calls greater than this
value will be left in the socket buffer for later handling
with recvfile (or userspace equivalent). Definition of
recvfile for your system is left as an exercise for
the reader (I'm working on getting splice working :-).
Jeremy.
(This used to be commit 11c03b75dd)
2007-10-30 16:22:24 -07:00
Jeremy Allison
30191d1a57 RIP BOOL. Convert BOOL -> bool. I found a few interesting
bugs in various places whilst doing this (places that assumed
BOOL == int). I also need to fix the Samba4 pidl generation
(next checkin).
Jeremy.
(This used to be commit f35a266b3c)
2007-10-18 17:40:25 -07:00