summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-07-05 16:27:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:23:49 -0500
commit5391750ce6db47678a03db4d67a016acff4fc8e2 (patch)
treedb3e956ba5dea945f303bea20420c675d840c53f /source3/smbd
parent0bc56a2e5ffd0e65e4770e10c80d9fec02950b36 (diff)
downloadsamba-5391750ce6db47678a03db4d67a016acff4fc8e2.tar.gz
samba-5391750ce6db47678a03db4d67a016acff4fc8e2.tar.bz2
samba-5391750ce6db47678a03db4d67a016acff4fc8e2.zip
r23725: Remove get_current_mid()
Jeremy, next one to review :-) (This used to be commit a50555dda7db5e848e337185ed91c41c2557f7be)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/open.c50
-rw-r--r--source3/smbd/process.c9
2 files changed, 33 insertions, 26 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 62a4fe0807..5cb8340e0e 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -644,6 +644,7 @@ static BOOL is_delete_request(files_struct *fsp) {
static BOOL delay_for_oplocks(struct share_mode_lock *lck,
files_struct *fsp,
+ uint16 mid,
int pass_number,
int oplock_request)
{
@@ -728,7 +729,7 @@ static BOOL delay_for_oplocks(struct share_mode_lock *lck,
DEBUG(10, ("Sending break request to PID %s\n",
procid_str_static(&exclusive->pid)));
- exclusive->op_mid = get_current_mid();
+ exclusive->op_mid = mid;
/* Create the message. */
share_mode_entry_to_message(msg, exclusive);
@@ -768,9 +769,9 @@ static BOOL request_timed_out(struct timeval request_time,
static void defer_open(struct share_mode_lock *lck,
struct timeval request_time,
struct timeval timeout,
+ uint16 mid,
struct deferred_open_record *state)
{
- uint16 mid = get_current_mid();
int i;
/* Paranoia check */
@@ -1065,7 +1066,9 @@ BOOL map_open_params_to_ntcreate(const char *fname, int deny_mode, int open_func
}
-static void schedule_defer_open(struct share_mode_lock *lck, struct timeval request_time)
+static void schedule_defer_open(struct share_mode_lock *lck,
+ struct timeval request_time,
+ uint16 mid)
{
struct deferred_open_record state;
@@ -1096,7 +1099,7 @@ static void schedule_defer_open(struct share_mode_lock *lck, struct timeval requ
state.id = lck->id;
if (!request_timed_out(request_time, timeout)) {
- defer_open(lck, request_time, timeout, &state);
+ defer_open(lck, request_time, timeout, mid, &state);
}
}
@@ -1443,8 +1446,10 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
}
/* First pass - send break only on batch oplocks. */
- if (delay_for_oplocks(lck, fsp, 1, oplock_request)) {
- schedule_defer_open(lck, request_time);
+ if ((req != NULL)
+ && delay_for_oplocks(lck, fsp, req->mid, 1,
+ oplock_request)) {
+ schedule_defer_open(lck, request_time, req->mid);
TALLOC_FREE(lck);
file_free(fsp);
return NT_STATUS_SHARING_VIOLATION;
@@ -1461,8 +1466,11 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
* status again. */
/* Second pass - send break for both batch or
* exclusive oplocks. */
- if (delay_for_oplocks(lck, fsp, 2, oplock_request)) {
- schedule_defer_open(lck, request_time);
+ if ((req != NULL)
+ && delay_for_oplocks(lck, fsp, req->mid, 2,
+ oplock_request)) {
+ schedule_defer_open(lck, request_time,
+ req->mid);
TALLOC_FREE(lck);
file_free(fsp);
return NT_STATUS_SHARING_VIOLATION;
@@ -1576,10 +1584,11 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
state.delayed_for_oplocks = False;
state.id = id;
- if (!request_timed_out(request_time,
- timeout)) {
+ if ((req != NULL)
+ && !request_timed_out(request_time,
+ timeout)) {
defer_open(lck, request_time, timeout,
- &state);
+ req->mid, &state);
}
}
@@ -1667,8 +1676,10 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
}
/* First pass - send break only on batch oplocks. */
- if (delay_for_oplocks(lck, fsp, 1, oplock_request)) {
- schedule_defer_open(lck, request_time);
+ if ((req != NULL)
+ && delay_for_oplocks(lck, fsp, req->mid, 1,
+ oplock_request)) {
+ schedule_defer_open(lck, request_time, req->mid);
TALLOC_FREE(lck);
fd_close(conn, fsp);
file_free(fsp);
@@ -1684,8 +1695,11 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
* status again. */
/* Second pass - send break for both batch or
* exclusive oplocks. */
- if (delay_for_oplocks(lck, fsp, 2, oplock_request)) {
- schedule_defer_open(lck, request_time);
+ if ((req != NULL)
+ && delay_for_oplocks(lck, fsp, req->mid, 2,
+ oplock_request)) {
+ schedule_defer_open(lck, request_time,
+ req->mid);
TALLOC_FREE(lck);
fd_close(conn, fsp);
file_free(fsp);
@@ -1709,8 +1723,10 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
* "goto top of this function", but don't tell
* anybody... */
- defer_open(lck, request_time, timeval_zero(),
- &state);
+ if (req != NULL) {
+ defer_open(lck, request_time, timeval_zero(),
+ req->mid, &state);
+ }
TALLOC_FREE(lck);
return status;
}
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index dd623e69a5..1cb2c27fd3 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -48,15 +48,6 @@ SIG_ATOMIC_T got_sig_term = 0;
extern BOOL global_machine_password_needs_changing;
extern int max_send;
-/****************************************************************************
- Function to return the current request mid from Inbuffer.
-****************************************************************************/
-
-uint16 get_current_mid(void)
-{
- return SVAL(InBuffer,smb_mid);
-}
-
/*
* Initialize a struct smb_request from an inbuf
*/