From f4092ecec722d7e2c04f3049630975af9e96bc07 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 30 Apr 2010 21:03:20 -0700 Subject: 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. --- source3/smbd/blocking.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'source3/smbd/blocking.c') 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. */ -- cgit