From patchwork Fri Feb 1 20:03:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 10793659 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 4E08E14E1 for ; Fri, 1 Feb 2019 20:04:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4036932C9E for ; Fri, 1 Feb 2019 20:04:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34C3D330BE; Fri, 1 Feb 2019 20:04:34 +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 E18EF32C9E for ; Fri, 1 Feb 2019 20:04:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730676AbfBAUEd (ORCPT ); Fri, 1 Feb 2019 15:04:33 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:41472 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730654AbfBAUEd (ORCPT ); Fri, 1 Feb 2019 15:04:33 -0500 Received: by mail-pf1-f196.google.com with SMTP id b7so3732273pfi.8 for ; Fri, 01 Feb 2019 12:04:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=6zDk1ODTjzk9I9ws0KumEuHVUsXThJPSbWETmCZZcM8=; b=UUhYNpFVDLwyq9cf4VE3j4wmkFjKbobE5v/3XZ0+EK0agkuWPA7/aLg0ia4Me/7IVd JfW50s0TeXKFaytWFZfUNy66Ds94/abh/KLYKY4x3mT2bFEVb9ZrjFnAY1UpEwuO3mwY w57eOne6A+yz6+0OZvcx5Xb6uFbtRgxYrR26m/5nuOLfRP4yMBqXrqrlTS4OQYgisNgY Q0+J8sXqJ28M8/E2uj2/HM+JFysOMYFWlOtxmwoMBJAspLrg+pn5RbI5K9hUM/wj/r9a jDK8B1sHp5QWAHkG2oY7TcqBYKeLiBc3VocNdzf5C9SwltIC+RBU7XvuAE5hbUjEJFWB oYCQ== 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=6zDk1ODTjzk9I9ws0KumEuHVUsXThJPSbWETmCZZcM8=; b=tALQoHPU+Il+xLhBSvxFMXymXVLhYeN/W5LSLy0+ZScUDmPduw9yRCnjT5gNKj6Dc5 Aq51jSi2AEe1lWQfEO3oOUjSftgUd6KnQZcqdl95aVCRdSqD2qVzSACBUWARbWWafuh/ G845D/CGuBJoq+Qm+iv5Ai/9TxIuM0xujmQ7tp+dHVzlZ3sBAnTjDrbtKTjM/ZoWXm4l yD5AVkOKiMFJ+smvNuGNgWZBw7v9jqzNm5tu6hXWhWqdRv55F32m/aAwRmO3kxqABDva sEgGRXtWu0L24tqZ56RD2zc4DjYIWwOl2wZUzNoMsOB54xQOs1coBSff4ExX8grU9ovc LG3w== X-Gm-Message-State: AHQUAubnDVZdLOVhrNV6Gi0JAfmK+V4vRepbYXh9kYJvSuk6QJDSOCsJ 057jcPWMqinYoS3DyxiZHXruCAc= X-Google-Smtp-Source: AHgI3Ia52EG5nWH8KG6OlVoio6FFdnUVMquxAtkJt4RqHGsitxjyoPMY2wzNbxubOw7T9eP/DyYiHQ== X-Received: by 2002:a63:8742:: with SMTP id i63mr3531980pge.298.1549051471887; Fri, 01 Feb 2019 12:04:31 -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.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Feb 2019 12:04:30 -0800 (PST) From: Pavel Shilovsky X-Google-Original-From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 08/23] CIFS: Count credits for malformed error pending responses Date: Fri, 1 Feb 2019 12:03:56 -0800 Message-Id: <1549051452-5968-9-git-send-email-pshilov@microsoft.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1549051452-5968-1-git-send-email-pshilov@microsoft.com> References: <1549051452-5968-1-git-send-email-pshilov@microsoft.com> 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 Even if the response is malformed, we should count credits granted by the server to avoid miscalculations and unnecessary reconnects due to client or server bugs. If the response has been received partially, the session will be reconnected anyway on the next iteration of the demultiplex thread, so counting credits for such cases shouldn't break things. Signed-off-by: Pavel Shilovsky Signed-off-by: Steve French --- fs/cifs/smb2ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 49667ae..79e23c3 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -1761,7 +1761,7 @@ smb2_is_status_pending(char *buf, struct TCP_Server_Info *server, int length) if (shdr->Status != STATUS_PENDING) return false; - if (!length) { + if (shdr->CreditRequest) { spin_lock(&server->req_lock); server->credits += le16_to_cpu(shdr->CreditRequest); spin_unlock(&server->req_lock);