summaryrefslogtreecommitdiff
path: root/source3/smbd/blocking.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-04-30 21:03:20 -0700
committerJeremy Allison <jra@samba.org>2010-04-30 21:03:20 -0700
commitf4092ecec722d7e2c04f3049630975af9e96bc07 (patch)
tree34767dbbd6dad945552c0ea60d187172ecd6394c /source3/smbd/blocking.c
parentdffeb12f3dcb339bc258a7fbc38bbf9ec8dd928e (diff)
downloadsamba-f4092ecec722d7e2c04f3049630975af9e96bc07.tar.gz
samba-f4092ecec722d7e2c04f3049630975af9e96bc07.tar.bz2
samba-f4092ecec722d7e2c04f3049630975af9e96bc07.zip
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.
Diffstat (limited to 'source3/smbd/blocking.c')
-rw-r--r--source3/smbd/blocking.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index c10899f5e6..83898a3098 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -33,14 +33,20 @@ static void received_unlock_msg(struct messaging_context *msg,
struct server_id server_id,
DATA_BLOB *data);
-static void brl_timeout_fn(struct event_context *event_ctx,
+void brl_timeout_fn(struct event_context *event_ctx,
struct timed_event *te,
struct timeval now,
void *private_data)
{
struct smbd_server_connection *sconn = smbd_server_conn;
- SMB_ASSERT(sconn->smb1.locks.brl_timeout == te);
- TALLOC_FREE(sconn->smb1.locks.brl_timeout);
+
+ if (sconn->allow_smb2) {
+ SMB_ASSERT(sconn->smb2.locks.brl_timeout == te);
+ TALLOC_FREE(sconn->smb2.locks.brl_timeout);
+ } else {
+ SMB_ASSERT(sconn->smb1.locks.brl_timeout == te);
+ TALLOC_FREE(sconn->smb1.locks.brl_timeout);
+ }
change_to_root_user(); /* TODO: Possibly run all timed events as
* root */
@@ -52,7 +58,7 @@ static void brl_timeout_fn(struct event_context *event_ctx,
We need a version of timeval_min that treats zero timval as infinite.
****************************************************************************/
-static struct timeval timeval_brl_min(const struct timeval *tv1,
+struct timeval timeval_brl_min(const struct timeval *tv1,
const struct timeval *tv2)
{
if (timeval_is_zero(tv1)) {
@@ -699,9 +705,14 @@ static void received_unlock_msg(struct messaging_context *msg,
void process_blocking_lock_queue(void)
{
struct smbd_server_connection *sconn = smbd_server_conn;
- struct timeval tv_curr = timeval_current();
+ struct timeval tv_curr;
struct blocking_lock_record *blr, *next = NULL;
+ if (sconn->allow_smb2) {
+ return process_blocking_lock_queue_smb2();
+ }
+
+ tv_curr = timeval_current();
/*
* Go through the queue and see if we can get any of the locks.
*/