diff options
author | Shirish Pargaonkar <shirishpargaonkar@gmail.com> | 2013-10-12 11:06:03 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2013-11-02 13:52:35 -0400 |
commit | 7f48558e6489d032b1584b0cc9ac4bb11072c034 (patch) | |
tree | 54c6b7529085229d53cae09cada37d548f848f26 /fs/cifs/transport.c | |
parent | 3d378d3fd82a759d59c60d89b4559bf325d7e668 (diff) |
cifs: Send a logoff request before removing a smb session
Send a smb session logoff request before removing smb session off of the list.
On a signed smb session, remvoing a session off of the list before sending
a logoff request results in server returning an error for lack of
smb signature.
Never seen an error during smb logoff, so as per MS-SMB2 3.2.5.1,
not sure how an error during logoff should be retried. So for now,
if a server returns an error to a logoff request, log the error and
remove the session off of the list.
Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r-- | fs/cifs/transport.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 0ee6d249ef6f..b37570952846 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -431,13 +431,20 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf, | |||
431 | return -EAGAIN; | 431 | return -EAGAIN; |
432 | } | 432 | } |
433 | 433 | ||
434 | if (ses->status != CifsGood) { | 434 | if (ses->status == CifsNew) { |
435 | /* check if SMB session is bad because we are setting it up */ | ||
436 | if ((in_buf->Command != SMB_COM_SESSION_SETUP_ANDX) && | 435 | if ((in_buf->Command != SMB_COM_SESSION_SETUP_ANDX) && |
437 | (in_buf->Command != SMB_COM_NEGOTIATE)) | 436 | (in_buf->Command != SMB_COM_NEGOTIATE)) |
438 | return -EAGAIN; | 437 | return -EAGAIN; |
439 | /* else ok - we are setting up session */ | 438 | /* else ok - we are setting up session */ |
440 | } | 439 | } |
440 | |||
441 | if (ses->status == CifsExiting) { | ||
442 | /* check if SMB session is bad because we are setting it up */ | ||
443 | if (in_buf->Command != SMB_COM_LOGOFF_ANDX) | ||
444 | return -EAGAIN; | ||
445 | /* else ok - we are shutting down session */ | ||
446 | } | ||
447 | |||
441 | *ppmidQ = AllocMidQEntry(in_buf, ses->server); | 448 | *ppmidQ = AllocMidQEntry(in_buf, ses->server); |
442 | if (*ppmidQ == NULL) | 449 | if (*ppmidQ == NULL) |
443 | return -ENOMEM; | 450 | return -ENOMEM; |