static BOOL delay_for_oplocks(struct share_mode_lock *lck,
files_struct *fsp,
+ uint16 mid,
int pass_number,
int oplock_request)
{
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);
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 */
}
-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;
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);
}
}
}
/* 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;
* 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;
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);
}
}
}
/* 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);
* 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);
* "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;
}