Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c9421e1 authored by Pavel Shilovsky's avatar Pavel Shilovsky Committed by Jeff Layton
Browse files

CIFS: Change mid_q_entry structure fields



to be protocol-unspecific and big enough to keep both CIFS
and SMB2 values.

Signed-off-by: default avatarPavel Shilovsky <piastry@etersoft.ru>
parent 243d04b6
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -80,15 +80,15 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
	spin_lock(&GlobalMid_Lock);
	list_for_each(tmp, &server->pending_mid_q) {
		mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
		cERROR(1, "State: %d Cmd: %d Pid: %d Cbdata: %p Mid %d",
			mid_entry->midState,
			(int)mid_entry->command,
		cERROR(1, "State: %d Cmd: %d Pid: %d Cbdata: %p Mid %llu",
			mid_entry->mid_state,
			le16_to_cpu(mid_entry->command),
			mid_entry->pid,
			mid_entry->callback_data,
			mid_entry->mid);
#ifdef CONFIG_CIFS_STATS2
		cERROR(1, "IsLarge: %d buf: %p time rcv: %ld now: %ld",
			mid_entry->largeBuf,
			mid_entry->large_buf,
			mid_entry->resp_buf,
			mid_entry->when_received,
			jiffies);
@@ -218,9 +218,9 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
				mid_entry = list_entry(tmp3, struct mid_q_entry,
					qhead);
				seq_printf(m, "\tState: %d com: %d pid:"
						" %d cbdata: %p mid %d\n",
						mid_entry->midState,
						(int)mid_entry->command,
					      " %d cbdata: %p mid %llu\n",
					      mid_entry->mid_state,
					      le16_to_cpu(mid_entry->command),
					      mid_entry->pid,
					      mid_entry->callback_data,
					      mid_entry->mid);
+5 −5
Original line number Diff line number Diff line
@@ -731,8 +731,8 @@ typedef void (mid_callback_t)(struct mid_q_entry *mid);
/* one of these for every pending CIFS request to the server */
struct mid_q_entry {
	struct list_head qhead;	/* mids waiting on reply from this server */
	__u16 mid;		/* multiplex id */
	__u16 pid;		/* process id */
	__u64 mid;		/* multiplex id */
	__u32 pid;		/* process id */
	__u32 sequence_number;  /* for CIFS signing */
	unsigned long when_alloc;  /* when mid was created */
#ifdef CONFIG_CIFS_STATS2
@@ -743,9 +743,9 @@ struct mid_q_entry {
	mid_callback_t *callback; /* call completion callback */
	void *callback_data;	  /* general purpose pointer for callback */
	void *resp_buf;		/* pointer to received SMB header */
	int midState;	/* wish this were enum but can not pass to wait_event */
	__u8 command;	/* smb command code */
	bool largeBuf:1;	/* if valid response, is pointer to large buf */
	int mid_state;	/* wish this were enum but can not pass to wait_event */
	__le16 command;		/* smb command code */
	bool large_buf:1;	/* if valid response, is pointer to large buf */
	bool multiRsp:1;	/* multiple trans2 responses for one request  */
	bool multiEnd:1;	/* both received */
};
+6 −6
Original line number Diff line number Diff line
@@ -1467,7 +1467,7 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid)
	pgoff_t eof_index;
	struct page *page, *tpage;

	cFYI(1, "%s: mid=%u offset=%llu bytes=%u", __func__,
	cFYI(1, "%s: mid=%llu offset=%llu bytes=%u", __func__,
		mid->mid, rdata->offset, rdata->bytes);

	/*
@@ -1665,10 +1665,10 @@ cifs_readv_callback(struct mid_q_entry *mid)
	struct cifs_tcon *tcon = tlink_tcon(rdata->cfile->tlink);
	struct TCP_Server_Info *server = tcon->ses->server;

	cFYI(1, "%s: mid=%u state=%d result=%d bytes=%u", __func__,
		mid->mid, mid->midState, rdata->result, rdata->bytes);
	cFYI(1, "%s: mid=%llu state=%d result=%d bytes=%u", __func__,
		mid->mid, mid->mid_state, rdata->result, rdata->bytes);

	switch (mid->midState) {
	switch (mid->mid_state) {
	case MID_RESPONSE_RECEIVED:
		/* result already set, check signature */
		if (server->sec_mode &
@@ -2086,7 +2086,7 @@ cifs_writedata_alloc(unsigned int nr_pages)
}

/*
 * Check the midState and signature on received buffer (if any), and queue the
 * Check the mid_state and signature on received buffer (if any), and queue the
 * workqueue completion task.
 */
static void
@@ -2097,7 +2097,7 @@ cifs_writev_callback(struct mid_q_entry *mid)
	unsigned int written;
	WRITE_RSP *smb = (WRITE_RSP *)mid->resp_buf;

	switch (mid->midState) {
	switch (mid->mid_state) {
	case MID_RESPONSE_RECEIVED:
		wdata->result = cifs_check_receive(mid, tcon->ses->server, 0);
		if (wdata->result != 0)
+11 −11
Original line number Diff line number Diff line
@@ -143,8 +143,8 @@ cifs_reconnect(struct TCP_Server_Info *server)
	spin_lock(&GlobalMid_Lock);
	list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
		mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
		if (mid_entry->midState == MID_REQUEST_SUBMITTED)
			mid_entry->midState = MID_RETRY_NEEDED;
		if (mid_entry->mid_state == MID_REQUEST_SUBMITTED)
			mid_entry->mid_state = MID_RETRY_NEEDED;
		list_move(&mid_entry->qhead, &retry_list);
	}
	spin_unlock(&GlobalMid_Lock);
@@ -575,8 +575,8 @@ find_mid(struct TCP_Server_Info *server, char *buffer)
	spin_lock(&GlobalMid_Lock);
	list_for_each_entry(mid, &server->pending_mid_q, qhead) {
		if (mid->mid == buf->Mid &&
		    mid->midState == MID_REQUEST_SUBMITTED &&
		    mid->command == buf->Command) {
		    mid->mid_state == MID_REQUEST_SUBMITTED &&
		    le16_to_cpu(mid->command) == buf->Command) {
			spin_unlock(&GlobalMid_Lock);
			return mid;
		}
@@ -593,9 +593,9 @@ dequeue_mid(struct mid_q_entry *mid, bool malformed)
#endif
	spin_lock(&GlobalMid_Lock);
	if (!malformed)
		mid->midState = MID_RESPONSE_RECEIVED;
		mid->mid_state = MID_RESPONSE_RECEIVED;
	else
		mid->midState = MID_RESPONSE_MALFORMED;
		mid->mid_state = MID_RESPONSE_MALFORMED;
	list_del_init(&mid->qhead);
	spin_unlock(&GlobalMid_Lock);
}
@@ -622,13 +622,13 @@ handle_mid(struct mid_q_entry *mid, struct TCP_Server_Info *server,
		} else {
			/* Have first buffer */
			mid->resp_buf = buf;
			mid->largeBuf = true;
			mid->large_buf = true;
			server->bigbuf = NULL;
		}
		return;
	}
	mid->resp_buf = buf;
	mid->largeBuf = server->large_buf;
	mid->large_buf = server->large_buf;
	/* Was previous buf put in mpx struct for multi-rsp? */
	if (!mid->multiRsp) {
		/* smb buffer will be freed by user thread */
@@ -684,8 +684,8 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server)
		spin_lock(&GlobalMid_Lock);
		list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
			mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
			cFYI(1, "Clearing mid 0x%x", mid_entry->mid);
			mid_entry->midState = MID_SHUTDOWN;
			cFYI(1, "Clearing mid 0x%llx", mid_entry->mid);
			mid_entry->mid_state = MID_SHUTDOWN;
			list_move(&mid_entry->qhead, &dispose_list);
		}
		spin_unlock(&GlobalMid_Lock);
@@ -693,7 +693,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server)
		/* now walk dispose list and issue callbacks */
		list_for_each_safe(tmp, tmp2, &dispose_list) {
			mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
			cFYI(1, "Callback mid 0x%x", mid_entry->mid);
			cFYI(1, "Callback mid 0x%llx", mid_entry->mid);
			list_del_init(&mid_entry->qhead);
			mid_entry->callback(mid_entry);
		}
+1 −1
Original line number Diff line number Diff line
@@ -268,7 +268,7 @@ __u64 GetNextMid(struct TCP_Server_Info *server)
		list_for_each_entry(mid_entry, &server->pending_mid_q, qhead) {
			++num_mids;
			if (mid_entry->mid == cur_mid &&
			    mid_entry->midState == MID_REQUEST_SUBMITTED) {
			    mid_entry->mid_state == MID_REQUEST_SUBMITTED) {
				/* This mid is in use, try a different one */
				collision = true;
				break;
Loading