From patchwork Fri Jul 13 07:53:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 1194291 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id B14B23FC4C for ; Fri, 13 Jul 2012 07:55:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755194Ab2GMHz6 (ORCPT ); Fri, 13 Jul 2012 03:55:58 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:45138 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755131Ab2GMHz5 (ORCPT ); Fri, 13 Jul 2012 03:55:57 -0400 Received: by mail-lb0-f174.google.com with SMTP id gm6so5433168lbb.19 for ; Fri, 13 Jul 2012 00:55:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=i5KApr3Rjrwc126qR/V/G2fnXm/hv6LiH9KPKRkdPHE=; b=yL+h3n+xwL7I6Um+g8hCOW07ljznPlYtJ3a6q8gXTMY5qzOxpX19HVQ+65Hi12KXY9 BZJHRfuJqhbFWdosjkLwv6lWcHJDY03+RWO76IASXXP5M+ixbb/oB+EJWroOfnnDhVS9 ehZu96FFC8avwF5inoln58iWFDD2i9HEukUTr/WQ9cGqZK9yuAWLbBR7ex5DVlqBEQtv IRYFm+6XRNQY/bCtYakapbTKfzouiB0gLxw196zWg1Hq9zhc6HGIa/5OoohQdisRs/yz jEPqyyI4QKO0dhYB1rUwmgqTW2soCVmWg59hbXiKf7ZyfVQdYOd0JNAu6HwrzA48thLd NN0Q== Received: by 10.112.103.194 with SMTP id fy2mr296390lbb.64.1342166157168; Fri, 13 Jul 2012 00:55:57 -0700 (PDT) Received: from localhost.localdomain ([178.45.132.158]) by mx.google.com with ESMTPS id er3sm1595545lbb.16.2012.07.13.00.55.55 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 13 Jul 2012 00:55:56 -0700 (PDT) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH v3 29/32] CIFS: Move echo code to osp struct Date: Fri, 13 Jul 2012 11:53:42 +0400 Message-Id: <1342166025-29377-30-git-send-email-pshilovsky@samba.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1342166025-29377-1-git-send-email-pshilovsky@samba.org> References: <1342166025-29377-1-git-send-email-pshilovsky@samba.org> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Signed-off-by: Pavel Shilovsky --- fs/cifs/cifsglob.h | 4 ++++ fs/cifs/connect.c | 10 ++++++---- fs/cifs/smb1ops.c | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 5e4d1c5..0c53a83 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -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 { diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index d757427..48233a3 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -405,15 +405,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); diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 7bd4973..c9326b4 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c @@ -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 = {