Пример #1
0
static void onefs_cbrl_async_success(uint64_t id)
{
	struct blocking_lock_record *blr;
	struct onefs_cbrl_blr_state *bs;
	uint16 num_locks;

	DEBUG(10, ("CBRL async success!\n"));

	/* Find BLR with id. Its okay not to find one (race with cancel) */
	blr = onefs_cbrl_find_blr(id);
	if (blr == NULL)
		return;

	bs = (struct onefs_cbrl_blr_state *)blr->blr_private;
	SMB_ASSERT(bs);
	SMB_ASSERT(bs->state == ONEFS_CBRL_ASYNC);

	blr->lock_num++;

	num_locks = SVAL(blr->req->vwv+7, 0);

	if (blr->lock_num == num_locks)
		bs->state = ONEFS_CBRL_DONE;
	else
		bs->state = ONEFS_CBRL_NONE;

	/* Self contend our own level 2 oplock. The kernel handles
	 * contention of other opener's level 2 oplocks. */
	contend_level2_oplocks_begin(blr->fsp,
	    LEVEL2_CONTEND_WINDOWS_BRL);

	/* Process the queue, to try the next lock or finish up. */
	process_blocking_lock_queue();
}
Пример #2
0
static void received_unlock_msg(struct messaging_context *msg,
				void *private_data,
				uint32_t msg_type,
				struct server_id server_id,
				DATA_BLOB *data)
{
	DEBUG(10,("received_unlock_msg\n"));
	process_blocking_lock_queue();
}
Пример #3
0
static void brl_timeout_fn(struct event_context *event_ctx,
			   struct timed_event *te,
			   struct timeval now,
			   void *private_data)
{
	SMB_ASSERT(brl_timeout == te);
	TALLOC_FREE(brl_timeout);

	change_to_root_user();	/* TODO: Possibly run all timed events as
				 * root */

	process_blocking_lock_queue();
}
Пример #4
0
static void received_unlock_msg(struct messaging_context *msg,
				void *private_data,
				uint32_t msg_type,
				struct server_id server_id,
				DATA_BLOB *data)
{
	struct smbd_server_connection *sconn =
		talloc_get_type_abort(private_data,
		struct smbd_server_connection);

	DEBUG(10,("received_unlock_msg\n"));
	process_blocking_lock_queue(sconn);
}
Пример #5
0
static void received_unlock_msg(struct messaging_context *msg,
				void *private_data,
				uint32_t msg_type,
				struct server_id server_id,
				DATA_BLOB *data)
{
	struct smbd_server_connection *sconn;

	sconn = msg_ctx_to_sconn(msg);
	if (sconn == NULL) {
		DEBUG(1, ("could not find sconn\n"));
		return;
	}

	DEBUG(10,("received_unlock_msg\n"));
	process_blocking_lock_queue(sconn);
}
Пример #6
0
void brl_timeout_fn(struct tevent_context *event_ctx,
			   struct tevent_timer *te,
			   struct timeval now,
			   void *private_data)
{
	struct smbd_server_connection *sconn = talloc_get_type_abort(
		private_data, struct smbd_server_connection);

	if (sconn->using_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 */

	process_blocking_lock_queue(sconn);
}
Пример #7
0
static void onefs_cbrl_async_failure(uint64_t id)
{
	struct blocking_lock_record *blr;
	struct onefs_cbrl_blr_state *bs;

	DEBUG(10, ("CBRL async failure!\n"));

	/* Find BLR with id. Its okay not to find one (race with cancel) */
	blr = onefs_cbrl_find_blr(id);
	if (blr == NULL)
		return;

	bs = (struct onefs_cbrl_blr_state *)blr->blr_private;
	SMB_ASSERT(bs);

	SMB_ASSERT(bs->state == ONEFS_CBRL_ASYNC);
	bs->state = ONEFS_CBRL_ERROR;

	/* Process the queue. It will end up trying to retake the same lock,
	 * see the error in onefs_cbrl_lock_windows() and fail. */
	process_blocking_lock_queue();
}