1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

smbd: Replace a 0-timeout wakeup_send

A tevent_immediate is simpler and is what we want here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Volker Lendecke 2013-08-16 11:40:38 +00:00 committed by Michael Adam
parent 1808316b12
commit e7dab403c0

View File

@ -632,7 +632,9 @@ struct break_to_none_state {
struct smbd_server_connection *sconn;
struct file_id id;
};
static void do_break_to_none(struct tevent_req *req);
static void do_break_to_none(struct tevent_context *ctx,
struct tevent_immediate *im,
void *private_data);
/****************************************************************************
This function is called on any file modification or lock request. If a file
@ -644,7 +646,7 @@ static void contend_level2_oplocks_begin_default(files_struct *fsp,
enum level2_contention_type type)
{
struct smbd_server_connection *sconn = fsp->conn->sconn;
struct tevent_req *req;
struct tevent_immediate *im;
struct break_to_none_state *state;
/*
@ -673,31 +675,25 @@ static void contend_level2_oplocks_begin_default(files_struct *fsp,
state->sconn = sconn;
state->id = fsp->file_id;
req = tevent_wakeup_send(state, sconn->ev_ctx, timeval_set(0, 0));
if (req == NULL) {
DEBUG(1, ("tevent_wakeup_send failed\n"));
im = tevent_create_immediate(state);
if (im == NULL) {
DEBUG(1, ("tevent_create_immediate failed\n"));
TALLOC_FREE(state);
return;
}
tevent_req_set_callback(req, do_break_to_none, state);
return;
tevent_schedule_immediate(im, sconn->ev_ctx, do_break_to_none, state);
}
static void do_break_to_none(struct tevent_req *req)
static void do_break_to_none(struct tevent_context *ctx,
struct tevent_immediate *im,
void *private_data)
{
struct break_to_none_state *state = tevent_req_callback_data(
req, struct break_to_none_state);
struct break_to_none_state *state = talloc_get_type_abort(
private_data, struct break_to_none_state);
struct server_id self = messaging_server_id(state->sconn->msg_ctx);
bool ret;
int i;
struct share_mode_lock *lck;
ret = tevent_wakeup_recv(req);
TALLOC_FREE(req);
if (!ret) {
DEBUG(1, ("tevent_wakeup_recv failed\n"));
goto done;
}
lck = get_existing_share_mode_lock(talloc_tos(), state->id);
if (lck == NULL) {
DEBUG(1, ("release_level_2_oplocks_on_change: failed to lock "