CIFS: Move echo code to osp struct
authorPavel Shilovsky <pshilovsky@samba.org>
Fri, 25 May 2012 10:47:16 +0000 (14:47 +0400)
committerPavel Shilovsky <pshilovsky@samba.org>
Tue, 24 Jul 2012 17:55:15 +0000 (21:55 +0400)
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
fs/cifs/cifsglob.h
fs/cifs/connect.c
fs/cifs/smb1ops.c

index 5e4d1c56767da362a49bb0f954fda3457c5d1723..0c53a83392536e10da3bab228f0afe77892a8e3f 100644 (file)
@@ -234,6 +234,10 @@ struct smb_version_operations {
        /* build a full path to the root of the mount */
        char * (*build_path_to_root)(struct smb_vol *, struct cifs_sb_info *,
                                     struct cifs_tcon *);
+       /* check if we can send an echo or nor */
+       bool (*can_echo)(struct TCP_Server_Info *);
+       /* send echo request */
+       int (*echo)(struct TCP_Server_Info *);
 };
 
 struct smb_version_values {
index 7b4bc1e0b08eaf95da0212890c35d7f11e617ce6..a83ed766aa945d8533506708905f9d475858a3ec 100644 (file)
@@ -406,15 +406,17 @@ cifs_echo_request(struct work_struct *work)
                                        struct TCP_Server_Info, echo.work);
 
        /*
-        * We cannot send an echo until the NEGOTIATE_PROTOCOL request is
-        * done, which is indicated by maxBuf != 0. Also, no need to ping if
-        * we got a response recently
+        * We cannot send an echo if it is disabled or until the
+        * NEGOTIATE_PROTOCOL request is done, which is indicated by
+        * server->ops->need_neg() == true. Also, no need to ping if
+        * we got a response recently.
         */
        if (!server->ops->need_neg || server->ops->need_neg(server) ||
+           (server->ops->can_echo && !server->ops->can_echo(server)) ||
            time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL - HZ))
                goto requeue_echo;
 
-       rc = CIFSSMBEcho(server);
+       rc = server->ops->echo ? server->ops->echo(server) : -ENOSYS;
        if (rc)
                cFYI(1, "Unable to send echo request to server: %s",
                        server->hostname);
index 7bd4973591deefdb45f87d043e0a70b200d2fa50..c9326b4ec6cd92cd6dfe7ecf55202ab25fc7254a 100644 (file)
@@ -551,6 +551,7 @@ struct smb_version_operations smb1_operations = {
        .query_path_info = cifs_query_path_info,
        .get_srv_inum = cifs_get_srv_inum,
        .build_path_to_root = cifs_build_path_to_root,
+       .echo = CIFSSMBEcho,
 };
 
 struct smb_version_values smb1_values = {