cifs: refactor mid finding loop in cifs_demultiplex_thread
...to reduce the extreme indentation. This should introduce no behavioral changes. Cc: stable@kernel.org Acked-by: David Howells <dhowells@redhat.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
committed by
Steve French
parent
2a2047bc94
commit
146f9f65bd
@@ -617,9 +617,13 @@ incomplete_rcv:
|
|||||||
list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
|
list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
|
||||||
mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
|
mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
|
||||||
|
|
||||||
if ((mid_entry->mid == smb_buffer->Mid) &&
|
if (mid_entry->mid != smb_buffer->Mid ||
|
||||||
(mid_entry->midState == MID_REQUEST_SUBMITTED) &&
|
mid_entry->midState != MID_REQUEST_SUBMITTED ||
|
||||||
(mid_entry->command == smb_buffer->Command)) {
|
mid_entry->command != smb_buffer->Command) {
|
||||||
|
mid_entry = NULL;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (length == 0 &&
|
if (length == 0 &&
|
||||||
check2ndT2(smb_buffer, server->maxBuf) > 0) {
|
check2ndT2(smb_buffer, server->maxBuf) > 0) {
|
||||||
/* We have a multipart transact2 resp */
|
/* We have a multipart transact2 resp */
|
||||||
@@ -628,26 +632,26 @@ incomplete_rcv:
|
|||||||
/* merge response - fix up 1st*/
|
/* merge response - fix up 1st*/
|
||||||
if (coalesce_t2(smb_buffer,
|
if (coalesce_t2(smb_buffer,
|
||||||
mid_entry->resp_buf)) {
|
mid_entry->resp_buf)) {
|
||||||
mid_entry->multiRsp =
|
mid_entry->multiRsp = true;
|
||||||
true;
|
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
/* all parts received */
|
/* all parts received */
|
||||||
mid_entry->multiEnd =
|
mid_entry->multiEnd = true;
|
||||||
true;
|
|
||||||
goto multi_t2_fnd;
|
goto multi_t2_fnd;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!isLargeBuf) {
|
if (!isLargeBuf) {
|
||||||
cERROR(1, "1st trans2 resp needs bigbuf");
|
/*
|
||||||
/* BB maybe we can fix this up, switch
|
* FIXME: switch to already
|
||||||
to already allocated large buffer? */
|
* allocated largebuf?
|
||||||
|
*/
|
||||||
|
cERROR(1, "1st trans2 resp "
|
||||||
|
"needs bigbuf");
|
||||||
} else {
|
} else {
|
||||||
/* Have first buffer */
|
/* Have first buffer */
|
||||||
mid_entry->resp_buf =
|
mid_entry->resp_buf =
|
||||||
smb_buffer;
|
smb_buffer;
|
||||||
mid_entry->largeBuf =
|
mid_entry->largeBuf = true;
|
||||||
true;
|
|
||||||
bigbuf = NULL;
|
bigbuf = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -657,11 +661,9 @@ incomplete_rcv:
|
|||||||
mid_entry->largeBuf = isLargeBuf;
|
mid_entry->largeBuf = isLargeBuf;
|
||||||
multi_t2_fnd:
|
multi_t2_fnd:
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
mid_entry->midState =
|
mid_entry->midState = MID_RESPONSE_RECEIVED;
|
||||||
MID_RESPONSE_RECEIVED;
|
|
||||||
else
|
else
|
||||||
mid_entry->midState =
|
mid_entry->midState = MID_RESPONSE_MALFORMED;
|
||||||
MID_RESPONSE_MALFORMED;
|
|
||||||
#ifdef CONFIG_CIFS_STATS2
|
#ifdef CONFIG_CIFS_STATS2
|
||||||
mid_entry->when_received = jiffies;
|
mid_entry->when_received = jiffies;
|
||||||
#endif
|
#endif
|
||||||
@@ -669,8 +671,6 @@ multi_t2_fnd:
|
|||||||
mid_entry->callback(mid_entry);
|
mid_entry->callback(mid_entry);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mid_entry = NULL;
|
|
||||||
}
|
|
||||||
spin_unlock(&GlobalMid_Lock);
|
spin_unlock(&GlobalMid_Lock);
|
||||||
|
|
||||||
if (mid_entry != NULL) {
|
if (mid_entry != NULL) {
|
||||||
|
Reference in New Issue
Block a user