From patchwork Thu Mar 23 16:55:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 742788 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3vpt3g2rdHz9s3w; Fri, 24 Mar 2017 03:55:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical-com.20150623.gappssmtp.com header.i=@canonical-com.20150623.gappssmtp.com header.b="kVZuJswy"; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1cr61g-0006mw-9f; Thu, 23 Mar 2017 16:55:52 +0000 Received: from mail-io0-f181.google.com ([209.85.223.181]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1cr61a-0006mr-La for kernel-team@lists.ubuntu.com; Thu, 23 Mar 2017 16:55:46 +0000 Received: by mail-io0-f181.google.com with SMTP id b140so1119568iof.1 for ; Thu, 23 Mar 2017 09:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=avV2vQTQQnXp35ytsWK3351PHIa1S/8MSftgFH+5kro=; b=kVZuJswy434SqZCc/yoyrIw9yFeoVIQvDV9HJLWitmW+RdaNfE5t+HoP7z65pfN7ov LX5Zh3+feLeIDMR5bvc0eOfc94ECBi8fZ03JBw/Y0g4v6MEakTkRADQIc5VAhiO0Srui tPeHM3oyI0ugEMXnbQIHq7aq3JGiezfNd1bL3WBnaH+NluGo5Ck/WueOdIynnnT7XOb1 wvsxWBqC0bjVdA8Sq1LnQ4ryHLR34F5tAI5qQ/9KzxsZ/Mf4JmgvGH4z8M6KX75VZ255 WUSSGOpZBtM7mZ78WjffZOWS4aMAQS6E9nRqCFYwWGr5K/oZ0uSjaT5Kho0kxbI3+OVp WxCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=avV2vQTQQnXp35ytsWK3351PHIa1S/8MSftgFH+5kro=; b=SHm3/I6eQX/UjW/4fR+DaNPYzegfW7PcQCdNmKrbpa/3ft7s+Szr8QV+jj0jTulWlR Bdsse5Efa1+zwFio7BgnS6NMSErk6cu8pT6wWXdEoLgFpqU6z0JglhaW/D8tipHCsxne 5jfjGNmNNvdUQVNA9+Os/rLLp9Bgj28B5Flq80FW6AoiObDnmzk5lsA0R4uNdgsNqHnC xG9m1RUrX3wKHUFODsWivgbWYR70fK1UP4/CujLsobjz8vFMjF21wLZnXuVN3kvSH3Oi KWdNXd9IIuLnxMd81wQ4W+vupmtldhDK/6fCCkwrBOLv/AqPjz0Dbe0YdKk/zUMZhR8W fWtA== X-Gm-Message-State: AFeK/H3uyiwt55ttXaF90hfzUBohUgCSXdtdql5a7wGUG1VRkyRGbgWFKw93F4OWb8TtQ9qm X-Received: by 10.107.129.66 with SMTP id c63mr3782327iod.92.1490288145319; Thu, 23 Mar 2017 09:55:45 -0700 (PDT) Received: from localhost.localdomain (host-98-127-250-84.bln-mt.client.bresnan.net. [98.127.250.84]) by smtp.gmail.com with ESMTPSA id m71sm1949172itg.14.2017.03.23.09.55.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Mar 2017 09:55:44 -0700 (PDT) From: Tim Gardner To: kernel-team@lists.ubuntu.com Subject: [PATCH V2] Call echo service immediately after socket reconnect Date: Thu, 23 Mar 2017 10:55:40 -0600 Message-Id: <1490288140-3939-1-git-send-email-tim.gardner@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20170315160210.xp5a2u6xp7n4ne3d@calabresa> References: <20170315160210.xp5a2u6xp7n4ne3d@calabresa> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Sachin Prabhu BugLink: http://bugs.launchpad.net/bugs/1669941 Commit 4fcd1813e640 ("Fix reconnect to not defer smb3 session reconnect long after socket reconnect") changes the behaviour of the SMB2 echo service and causes it to renegotiate after a socket reconnect. However under default settings, the echo service could take up to 120 seconds to be scheduled. The patch forces the echo service to be called immediately resulting a negotiate call being made immediately on reconnect. Signed-off-by: Sachin Prabhu Reviewed-by: Pavel Shilovsky Signed-off-by: Steve French (back ported from commit b8c600120fc87d53642476f48c8055b38d6e14c7) Signed-off-by: Tim Gardner Conflicts: fs/cifs/connect.c Acked-by: Thadeu Lima de Souza Cascardo --- V2 - responded to list comments, restored queue_delayed_work(cifsiod_wq, &server->echo, SMB_ECHO_INTERVAL); fs/cifs/connect.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 3521512..487129f 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -412,6 +412,9 @@ cifs_reconnect(struct TCP_Server_Info *server) } } while (server->tcpStatus == CifsNeedReconnect); + if (server->tcpStatus == CifsNeedNegotiate) + mod_delayed_work(cifsiod_wq, &server->echo, 0); + return rc; } @@ -421,18 +424,27 @@ cifs_echo_request(struct work_struct *work) int rc; struct TCP_Server_Info *server = container_of(work, struct TCP_Server_Info, echo.work); + unsigned long echo_interval; + + /* + * If we need to renegotiate, set echo interval to zero to + * immediately call echo service where we can renegotiate. + */ + if (server->tcpStatus == CifsNeedNegotiate) + echo_interval = 0; + else + echo_interval = SMB_ECHO_INTERVAL; /* - * 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. + * We cannot send an echo if it is disabled. + * Also, no need to ping if we got a response recently. */ if (server->tcpStatus == CifsNeedReconnect || - server->tcpStatus == CifsExiting || server->tcpStatus == CifsNew || + server->tcpStatus == CifsExiting || + server->tcpStatus == CifsNew || (server->ops->can_echo && !server->ops->can_echo(server)) || - time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL - HZ)) + time_before(jiffies, server->lstrp + echo_interval - HZ)) goto requeue_echo; rc = server->ops->echo ? server->ops->echo(server) : -ENOSYS;