Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5243506imu; Tue, 15 Jan 2019 13:57:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN7EcP/ozmdAGS1qaAWUNKvi5Ip+oULyIOU1gL9rrUjCJ5N8Urfup7TqyjLTmGWokIyYpC+1 X-Received: by 2002:a62:8a51:: with SMTP id y78mr6167915pfd.35.1547589452807; Tue, 15 Jan 2019 13:57:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547589452; cv=none; d=google.com; s=arc-20160816; b=Y5/d5Uc3yXdIzN+sKBf+woXppTpJzrZcMRNAgpxAEVF+y4QnJi2zB6njF80AsaGfYB wI1MWh/wzl00e9ONCL/vrhsiJYsn86MxMMDJmpapGfuqVHiIjxCNxuGtgTafLxHDS+Fd RYyFlCUrr7/b6r9OTO75EiIlf7rWJzrIiuiU4MO4kYZ1YvzFwFNqo5WwDp/9WAAB4rZ8 MsRoJdtgrAfKeZlCINsH7Dys5hg95hZnefS0o7vbYMo0REBEZQQvGRiku04NKKpvj9I7 0eb48Nnw6hELTwY84dYWqnQVIUA/rFtp5kdlqNpxeu2f9YMmbI2aCZDyfvZpm3GTiXek DaHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=V4KLts3Dj5SP0EMs9a4pDECHicM3g3Gk/5o7sPRr98Y=; b=odGYESOGNgO8Z4JmYrZcmgHlbbDRgXugf13uXAE746/pRpAnl5LvdWeTXlejL46mPa 5oj7peH2p+Eit5ZsxuPg/3M3+C9/YOPRRhpQMGcy4Oj7GfMX/JUqWD9VJ1uSyQeslC6d OgGUaLtVrc2o3fWc1fLMTWVKW+YjsT+FUm+WRXmTZhF5lC2oU0XAHcDg43QZ7tfDz9+Z 5hjzYDAP5lTCgXmobwzkczEuSBAe/j8/yl5NSEZb+Y8MOunh0mJ2k8skK8qLoJ4oKrqJ lDgNBrY+syaaQmAvuQ53ggKmN1E1vx+j2lrj/nMtVL6QKHRZkXVePpPN641zmVshm8jq v7JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1TWeXeaK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bb4si4296077plb.322.2019.01.15.13.57.16; Tue, 15 Jan 2019 13:57:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1TWeXeaK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387397AbfAOQnr (ORCPT + 99 others); Tue, 15 Jan 2019 11:43:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:33256 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731633AbfAOQnn (ORCPT ); Tue, 15 Jan 2019 11:43:43 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CA33F2054F; Tue, 15 Jan 2019 16:43:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547570623; bh=jok/EpH1o3jvskm95QHvUcwmPw+Q/2aJKstzyhjJ5KI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1TWeXeaKWZ7qiFR0AHxBxKd1ow9KmBgs8hr+7Yis/YNqXUMIxcvzYyD8z2ZQHL+Pd 96dzISBHuuODSMsS13S8zouaSL/qaY1hRilbKBK5qJHx4QeO3jv8GnuHMgCdJnD2m4 5bciYbDKaUUDJv1KgWmNrGpqN+1HfT9D1DAWn0RY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Shilovsky , Steve French Subject: [PATCH 4.20 12/57] CIFS: Fix adjustment of credits for MTU requests Date: Tue, 15 Jan 2019 17:35:53 +0100 Message-Id: <20190115154911.413721821@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190115154910.734892368@linuxfoundation.org> References: <20190115154910.734892368@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pavel Shilovsky commit b983f7e92348d7e7d091db1b78b7915e9dd3d63a upstream. Currently for MTU requests we allocate maximum possible credits in advance and then adjust them according to the request size. While we were adjusting the number of credits belonging to the server, we were skipping adjustment of credits belonging to the request. This patch fixes it by setting request credits to CreditCharge field value of SMB2 packet header. Also ask 1 credit more for async read and write operations to increase parallelism and match the behavior of other operations. Signed-off-by: Pavel Shilovsky Signed-off-by: Steve French CC: Stable Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2pdu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -3197,12 +3197,14 @@ smb2_async_readv(struct cifs_readdata *r if (rdata->credits) { shdr->CreditCharge = cpu_to_le16(DIV_ROUND_UP(rdata->bytes, SMB2_MAX_BUFFER_SIZE)); - shdr->CreditRequest = shdr->CreditCharge; + shdr->CreditRequest = + cpu_to_le16(le16_to_cpu(shdr->CreditCharge) + 1); spin_lock(&server->req_lock); server->credits += rdata->credits - le16_to_cpu(shdr->CreditCharge); spin_unlock(&server->req_lock); wake_up(&server->request_q); + rdata->credits = le16_to_cpu(shdr->CreditCharge); flags |= CIFS_HAS_CREDITS; } @@ -3474,12 +3476,14 @@ smb2_async_writev(struct cifs_writedata if (wdata->credits) { shdr->CreditCharge = cpu_to_le16(DIV_ROUND_UP(wdata->bytes, SMB2_MAX_BUFFER_SIZE)); - shdr->CreditRequest = shdr->CreditCharge; + shdr->CreditRequest = + cpu_to_le16(le16_to_cpu(shdr->CreditCharge) + 1); spin_lock(&server->req_lock); server->credits += wdata->credits - le16_to_cpu(shdr->CreditCharge); spin_unlock(&server->req_lock); wake_up(&server->request_q); + wdata->credits = le16_to_cpu(shdr->CreditCharge); flags |= CIFS_HAS_CREDITS; }