From patchwork Wed Jan 23 21:10:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 10777879 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 32F3191E for ; Wed, 23 Jan 2019 21:10:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2384E2D7B2 for ; Wed, 23 Jan 2019 21:10:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17C162D840; Wed, 23 Jan 2019 21:10:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACAAD2D7B2 for ; Wed, 23 Jan 2019 21:10:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726435AbfAWVKx (ORCPT ); Wed, 23 Jan 2019 16:10:53 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:38837 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726345AbfAWVKx (ORCPT ); Wed, 23 Jan 2019 16:10:53 -0500 Received: by mail-pf1-f196.google.com with SMTP id q1so1802538pfi.5 for ; Wed, 23 Jan 2019 13:10:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=jDH7aaJNC27ixXVO05/+kMj+VunD6fyC8NoXV2JD97w=; b=eI/Mm0RZ9u9mo/r7+kRlavxHtJkSP86aGZsatZmcp3TF6mFQ8jYcB4mkyltmSFh3rH 6FLo0qKKDYXwo/8a3kf2qa2HHQkGtM0BDtA98I5yj5Xp0k2WUtGuYRHfwI7Cf0f0X7Xo 4e4czJzCdRrwVY9cX6tQagW7Z8XtoExvIUq4X3LGmSYIgPpRAuJIiEXvQ2ozr7TpgPOv OtRLy5zRD2E6hogDvlMy1r8sTlE1btwFDMfVxaa0pR7m7zzXL2/WdMXsZsYVUi6wYIto xK/ocurxvbOxl8rxUS6+mCeu+GVa/0aHgUPZ9Vn+IHe+G13iowDoif7j4wv4KcM01IM/ 9EQQ== 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; bh=jDH7aaJNC27ixXVO05/+kMj+VunD6fyC8NoXV2JD97w=; b=DVGK/DiNYHPN4UQa21+7bg3M91lOFujUih9Dzcoy6/2EkAFw8GQCi6MPEYR/6ahgQh iA1lyVXsrs6LVImx3DUXWlSHRR8AYDWSrR1fbxSVtKmDjQNk2BzToMg+4sFj8j6kwiAM sGxwj0OnKyPOVyRG6l11WQoKKKo9fxa+e+brgWoZaO4aCeEUYLUWhYCsEg+GCVfaWOJC WFKMr1Q3+3zKXQ63Jr/y+4qFAZ48uV6hIAUQAO/1EdSwS5zLAmGWS92um9wQUpVOQd4t RvEUTiP/HV1GzMWf78kEccl317PSH6yR0luBeWEt3CspHxCMJL7qvZYP7KW9MgeB6WvF e9PA== X-Gm-Message-State: AJcUukfcQUJS4R4OIcbzqimUkGJf8gh3OZ6uvDf8wGJ+EsQn7O3rjL0/ H8oxkkbVQXn6/NbltPrU2057kus= X-Google-Smtp-Source: ALg8bN7SUCAl682D1WloMHB1EJ+GXIHO/PA45xpQP0Gj5e6ObqY6lgQYhO57b5Z/Dir49C25OINZoQ== X-Received: by 2002:a63:4566:: with SMTP id u38mr3468865pgk.4.1548277851745; Wed, 23 Jan 2019 13:10:51 -0800 (PST) Received: from ubuntu-vm.corp.microsoft.com ([2001:4898:80e8:f:a17f:4e9f:6b7c:507d]) by smtp.gmail.com with ESMTPSA id n73sm28063714pfj.148.2019.01.23.13.10.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Jan 2019 13:10:50 -0800 (PST) From: Pavel Shilovsky X-Google-Original-From: Pavel Shilovsky To: linux-cifs@vger.kernel.org, Steve French , Ronnie Sahlberg Subject: [PATCH 00/15] Improve credits handling on reconnects Date: Wed, 23 Jan 2019 13:10:30 -0800 Message-Id: <1548277845-6746-1-git-send-email-pshilov@microsoft.com> X-Mailer: git-send-email 2.7.4 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch set aims to fix several issues with reconnect handling mostly related to credits. The first 6 patches are targeted for the current v5.0-rc kernel, the rest of the series is for v5.1. A brief description of patches: 1) fix possible segfaults on reconnect because we were calling cifs_reconnect() from places where it shouldn't be called. 2-3) fix missing credits on normal read responses with errors. 4) account for credits for malformed requests (we still have Credit Granted field) and always add 1 credit back for SMB1. 5) do not mistakenly count 1 credit per unreceived response for SMB2 async commands. 6) use cached root handle to query attributes. 7-9) minor read handling fixes 10) do not interrupt network send even if we receive a signal because it will break SMB session. 11-13) tie credits and TCP session it belongs to (reconnect isntance number) to fix credit handling on reconnects. 14-15) add extra checks just before sending SMB packets to insure we are using credits for the current TCP session. Reviews are welcome! Pavel Shilovsky (15): CIFS: Do not reconnect TCP session in add_credits() CIFS: Fix credits calculations for reads with errors CIFS: Fix credit calculation for encrypted reads with errors CIFS: Fix credit calculations in compound mid callback CIFS: Do not assume one credit for async responses CIFS: Fix mounts if the client is low on credits CIFS: Always reset read error to -EIO if no response CIFS: Do not consider -ENODATA as stat failure for reads CIFS: Respect SMB2 hdr preamble size in read responses CIFS: Mask signals during sock_sendmsg() CIFS: Set reconnect instance to one initially CIFS: Respect reconnect in MTU credits calculations CIFS: Respect reconnect in non-MTU credits calculations CIFS: Check for reconnects before sending async requests CIFS: Check for reconnects before sending compound requests fs/cifs/cifsglob.h | 29 ++++++---- fs/cifs/cifsproto.h | 5 +- fs/cifs/cifssmb.c | 51 +++++++++++------ fs/cifs/connect.c | 26 ++++++++- fs/cifs/file.c | 62 ++++++++++++-------- fs/cifs/smb1ops.c | 6 +- fs/cifs/smb2inode.c | 17 ++++++ fs/cifs/smb2ops.c | 86 +++++++++++++++++++--------- fs/cifs/smb2pdu.c | 88 ++++++++++++++++++++--------- fs/cifs/transport.c | 159 ++++++++++++++++++++++++++++++++++++++++------------ 10 files changed, 378 insertions(+), 151 deletions(-)