cifs: clean up sync_mid_result
Make it use a switch statement based on the value of the midStatus. If the resp_buf is set, then MID_RESPONSE_RECEIVED is too. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
parent
dad255b182
commit
74dd92a881
|
@ -363,29 +363,30 @@ sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
spin_lock(&GlobalMid_Lock);
|
cFYI(1, "%s: cmd=%d mid=%d state=%d", __func__, mid->command,
|
||||||
|
mid->mid, mid->midState);
|
||||||
|
|
||||||
if (mid->resp_buf) {
|
spin_lock(&GlobalMid_Lock);
|
||||||
|
switch (mid->midState) {
|
||||||
|
case MID_RESPONSE_RECEIVED:
|
||||||
spin_unlock(&GlobalMid_Lock);
|
spin_unlock(&GlobalMid_Lock);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
case MID_REQUEST_SUBMITTED:
|
||||||
|
/* socket is going down, reject all calls */
|
||||||
cERROR(1, "No response to cmd %d mid %d", mid->command, mid->mid);
|
if (server->tcpStatus == CifsExiting) {
|
||||||
if (mid->midState == MID_REQUEST_SUBMITTED) {
|
cERROR(1, "%s: canceling mid=%d cmd=0x%x state=%d",
|
||||||
if (server->tcpStatus == CifsExiting)
|
__func__, mid->mid, mid->command, mid->midState);
|
||||||
rc = -EHOSTDOWN;
|
rc = -EHOSTDOWN;
|
||||||
else
|
break;
|
||||||
mid->midState = MID_RETRY_NEEDED;
|
|
||||||
}
|
}
|
||||||
|
case MID_RETRY_NEEDED:
|
||||||
if (rc != -EHOSTDOWN) {
|
|
||||||
if (mid->midState == MID_RETRY_NEEDED) {
|
|
||||||
rc = -EAGAIN;
|
rc = -EAGAIN;
|
||||||
cFYI(1, "marking request for retry");
|
break;
|
||||||
} else {
|
default:
|
||||||
|
cERROR(1, "%s: invalid mid state mid=%d state=%d", __func__,
|
||||||
|
mid->mid, mid->midState);
|
||||||
rc = -EIO;
|
rc = -EIO;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
spin_unlock(&GlobalMid_Lock);
|
spin_unlock(&GlobalMid_Lock);
|
||||||
|
|
||||||
delete_mid(mid);
|
delete_mid(mid);
|
||||||
|
|
Loading…
Reference in New Issue