From patchwork Fri Feb 1 20:03:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 10793643 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 F1DC31390 for ; Fri, 1 Feb 2019 20:04:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF42732C9E for ; Fri, 1 Feb 2019 20:04:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D345C330BE; Fri, 1 Feb 2019 20:04:23 +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 61FFD32C9E for ; Fri, 1 Feb 2019 20:04:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730049AbfBAUEX (ORCPT ); Fri, 1 Feb 2019 15:04:23 -0500 Received: from mail-pg1-f171.google.com ([209.85.215.171]:41317 "EHLO mail-pg1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729192AbfBAUEW (ORCPT ); Fri, 1 Feb 2019 15:04:22 -0500 Received: by mail-pg1-f171.google.com with SMTP id m1so3419048pgq.8 for ; Fri, 01 Feb 2019 12:04:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=hMpS/ohSqH5I5NCGPeIHV/QaK9NpzsO9MrlhBPoSt/Y=; b=CCKce6nz0RgIbyGxPURkAXtCyARCuSkDN1wQjsvuqr3Z3Xk6mp6PZgjD4lOXHTP/eb 0SwjAeH95+qOePAIIWcFfJ1q0Zb5z+e3GKvSbYfmvZhVc8D53oxolLg+UsYPcpatlGdO FEPgDYk5HUwKA7mvm/7vZuIZ/GWonzN71GFKk6TQOIqLDuDA3vUuzg5FdzqZhLI4/h7I WOcL7lGWe716//5WKrtKRrhAAfYEpwhfh4LMzP4zjh20jkC0hA4pC/hq3gTOl++b7+bj 7RnY1EPFqcuMvxVds1zSiSLQWLkn7krmA8fWVEamx0V3QCZ+MW8YJBr4Dda132iOu0+a 5j9w== 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:mime-version :content-transfer-encoding; bh=hMpS/ohSqH5I5NCGPeIHV/QaK9NpzsO9MrlhBPoSt/Y=; b=F9KT8RbaLHrDGg+mP6Cl+3fGDEEXtkfwp0A+7KrM/JFV7ZjGPvLvxI/PNhLY9GLYv4 ryIUy7ILYYu12AHe1/lxMTFacO1Ob63aNLpP43d+l2Gc+ABX2WaVC229BFev7zT2CKaV Uqp5EgnjRMrJRGM2EWk6OoLiDEdKcFFnjAXSl+gAKkXpLAFLg5RLv7X5TKx+dvdZeea9 S4E7+h05KR9vhOwgl2RHh+Zx1B1OzrUP7K6aOof2ruCWXrhhN93dtKWYqqQF0DDnTZAP Qzn+nTL98d/JmXL6SoCVRBSn2+bjXsCxQL7jwfp4NEyw/rt7eDruVmQ+tI9U5KXnlQSS AYiw== X-Gm-Message-State: AHQUAubhYXzaQqsm5tf5T3JRZRxV8T9Nvcpxm1DgPgWF9J/ywEtR9Np3 MQ5dEWfkBqUYiE6Dy39NLZUb0ks= X-Google-Smtp-Source: AHgI3IYNJVhXKcp+eyAYZaXZwZ9watNLS8kYSL0YSYtoGjThAD5EyP9y1d3cr5SZj7dfdTNZ3f676g== X-Received: by 2002:a63:2ccb:: with SMTP id s194mr3553245pgs.214.1549051461228; Fri, 01 Feb 2019 12:04:21 -0800 (PST) Received: from ubuntu-vm.corp.microsoft.com ([2001:4898:80e8:0:a18e:4e9f:6b7c:507d]) by smtp.gmail.com with ESMTPSA id x11sm24247451pfe.72.2019.02.01.12.04.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Feb 2019 12:04:20 -0800 (PST) From: Pavel Shilovsky X-Google-Original-From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 00/23] Improve credits and error handling on reconnects Date: Fri, 1 Feb 2019 12:03:48 -0800 Message-Id: <1549051452-5968-1-git-send-email-pshilov@microsoft.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 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 patchset targets several problems related to credits and error handling happening on TCP reconnects. The following key points have been addressed: 1. Added coupling between credits and a TCP session, so credits don’t “move” between sessions. 2. Fixed credit handling for compounded requests. 3. Found and fixed many places where the client skips credits granted by the server. 4. Fixed handling of incomplete responses (due to network reconnects, partial receive, etc). 5. Fixed error paths in IO, so the client returns proper errors to the user space. 6. Fixed signal handling when sending packets though the network to avoid sending incomplete packets and breaking SMB session. 7. Fixed some memory and page cache related problems (null-pointer dereferences, memory leaks and leaving locked cache pages). 8. Improved logging and stats to help maintenance and support. The first 5 patches are marked for stable. Reviews are welcome. Pavel Shilovsky (23): CIFS: Fix possible oops and memory leaks in async IO CIFS: Fix trace command logging for SMB2 reads and writes CIFS: Do not count -ENODATA as failure for query directory CIFS: Do not consider -ENODATA as stat failure for reads CIFS: Fix leaking locked VFS cache pages in writeback retry CIFS: Always reset read error to -EIO if no response CIFS: Do not log credits when unmounting a share CIFS: Count SMB3 credits for malformed pending responses 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 CIFS: Adjust MTU credits before reopening a file CIFS: Remove custom credit adjustments for SMB2 async IO CIFS: Reopen file before get SMB2 MTU credits for async IO CIFS: Find and reopen a file before get MTU credits in writepages CIFS: Move unlocking pages from wdata_send_pages() CIFS: Move open file handling to writepages CIFS: Return error code when getting file handle for writeback CIFS: Try to acquire credits at once for compound requests fs/cifs/cifsglob.h | 45 ++++++--- fs/cifs/cifsproto.h | 8 +- fs/cifs/cifssmb.c | 48 ++++++---- fs/cifs/connect.c | 7 +- fs/cifs/file.c | 266 ++++++++++++++++++++++++++++++++++++---------------- fs/cifs/smb1ops.c | 6 +- fs/cifs/smb2ops.c | 77 ++++++++++++--- fs/cifs/smb2pdu.c | 144 ++++++++++++++-------------- fs/cifs/transport.c | 191 ++++++++++++++++++++++++++++++------- 9 files changed, 555 insertions(+), 237 deletions(-)