diff options
author | Jeff Layton <jlayton@redhat.com> | 2011-01-11 07:24:21 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2011-01-20 12:46:44 -0500 |
commit | 766fdbb57fdb1e53bc34c431103e95383d7f13ba (patch) | |
tree | 9e681dc6513441017603f90f45b9ffcdb5640719 /fs/cifs/cifssmb.c | |
parent | a6827c184ea9f5452e4aaa7c799dd3c7cc9ba05e (diff) |
cifs: add ability to send an echo request
Reviewed-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r-- | fs/cifs/cifssmb.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 3652cc60314c..54b9f5d8d1db 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -706,6 +706,53 @@ CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon) | |||
706 | return rc; | 706 | return rc; |
707 | } | 707 | } |
708 | 708 | ||
709 | /* | ||
710 | * This is a no-op for now. We're not really interested in the reply, but | ||
711 | * rather in the fact that the server sent one and that server->lstrp | ||
712 | * gets updated. | ||
713 | * | ||
714 | * FIXME: maybe we should consider checking that the reply matches request? | ||
715 | */ | ||
716 | static void | ||
717 | cifs_echo_callback(struct mid_q_entry *mid) | ||
718 | { | ||
719 | struct TCP_Server_Info *server = mid->callback_data; | ||
720 | |||
721 | DeleteMidQEntry(mid); | ||
722 | atomic_dec(&server->inFlight); | ||
723 | wake_up(&server->request_q); | ||
724 | } | ||
725 | |||
726 | int | ||
727 | CIFSSMBEcho(struct TCP_Server_Info *server) | ||
728 | { | ||
729 | ECHO_REQ *smb; | ||
730 | int rc = 0; | ||
731 | |||
732 | cFYI(1, "In echo request"); | ||
733 | |||
734 | rc = small_smb_init(SMB_COM_ECHO, 0, NULL, (void **)&smb); | ||
735 | if (rc) | ||
736 | return rc; | ||
737 | |||
738 | /* set up echo request */ | ||
739 | smb->hdr.Tid = cpu_to_le16(0xffff); | ||
740 | smb->hdr.WordCount = cpu_to_le16(1); | ||
741 | smb->EchoCount = cpu_to_le16(1); | ||
742 | smb->ByteCount = cpu_to_le16(1); | ||
743 | smb->Data[0] = 'a'; | ||
744 | smb->hdr.smb_buf_length += 3; | ||
745 | |||
746 | rc = cifs_call_async(server, (struct smb_hdr *)smb, | ||
747 | cifs_echo_callback, server); | ||
748 | if (rc) | ||
749 | cFYI(1, "Echo request failed: %d", rc); | ||
750 | |||
751 | cifs_small_buf_release(smb); | ||
752 | |||
753 | return rc; | ||
754 | } | ||
755 | |||
709 | int | 756 | int |
710 | CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses) | 757 | CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses) |
711 | { | 758 | { |