Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp2174990img; Wed, 27 Feb 2019 11:42:02 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib4hZH4XJddmnv+mSt4tgTFlqp6xytqatgLxU/psQ8nZu+CwQPPc3PQiq7LhCrzry4Wu/5W X-Received: by 2002:a17:902:aa06:: with SMTP id be6mr3898905plb.57.1551296522417; Wed, 27 Feb 2019 11:42:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551296522; cv=none; d=google.com; s=arc-20160816; b=nxAMhBpjzM0/G9LCTFfjpKwVuYmSG/8sVS21UI1JNYrli/5AKAPwM+GZgG7iSuzkk3 qjBK3FiLNRD7SbkC6ZgxegKZVSNEPQF+7BZLnBl3Uo4jIHzIiQ82wLxCrbtvjCUSlK+2 v87h9N6WF9IG4iA1sRcsNnH4E68JBhKbNQI1PKY1VXOoNAcbJIt7ULQJ3BG/fFlEY9FB f++wLVXcmAbjg2OulZmhPcLBjw1gBQiNKnDkpDg36M4PR/TwWdVMgB5ZkFn4A53xS9Ie 7SQgGhofOIhHzpt0rspM8oRypEpZywK7RQRphQ3yons2pDaZGEylk2V+qvF51SyAYKJi sVdw== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=481JWPdvQD4ABxmlLiRK3qPOb3BKyUezI917Cf7u/bk=; b=ACx0TeyPBgDmKEkhRgL9yYR+zp+uYuznvJpgBk3QgmDOxvZBrc+vTi23VKecw5AFf4 kxT1GgWP9eoCyzv1po6EzMLdUXK5fOe3/TB9oBXvauAZfq8H9Yft8/vw363HVxzB2wzJ EEoCPdD8hIYN9QTu3Fnpc18SlMaG/iO8ciSHssQqF/auktHMRGl0SNo7bKeozTHPOc1Z VfK7Bx6sYzz2R1MnKgktQrbnsfcOonw8wG1CWb205hD2yEVdzE7vcu/6ycS9Z7elfuxZ qQDtqAEfTqNdOxKHvdXu4XXUPrvCblI4lnU2oTLb9WAVYPiBo7II5jBeGktYdUlENQwF PJOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KkNQpld5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u5si17082924plm.225.2019.02.27.11.41.47; Wed, 27 Feb 2019 11:42:02 -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=@gmail.com header.s=20161025 header.b=KkNQpld5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730254AbfB0Tjq (ORCPT + 99 others); Wed, 27 Feb 2019 14:39:46 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:35340 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728651AbfB0Tjq (ORCPT ); Wed, 27 Feb 2019 14:39:46 -0500 Received: by mail-lf1-f68.google.com with SMTP id m73so7780000lfa.2; Wed, 27 Feb 2019 11:39:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=481JWPdvQD4ABxmlLiRK3qPOb3BKyUezI917Cf7u/bk=; b=KkNQpld5WRWI8eWr3cCeV3MdwDHJQgZDGFanGme7sE+G48jrx0Jodff1BQ/G8hsYIL K6KwVFQtdf+cod5G4KtEvvtwRXt6D2YkxxUiYXZTkAU+sIdw7plzit900LLbpuxbinPr qnoGFr7DYTwMLiAqjC0gxoc70folIJkL1bixeEP/yagQCK0d1L7zLGY0LGK6fUV5llfS 7XjmsjwX8W5nbiO10MRCGuX51pDe9/KY2IqMRRqbxo0yalWhclkG4o13v1zprp6HCvsn jvcsR3okkQHFq9/jTmFPhn5KUAkf/TJ8lgy0wQYEHevbmd1gpqsRuNJa4C34OS8GAxpl C14w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=481JWPdvQD4ABxmlLiRK3qPOb3BKyUezI917Cf7u/bk=; b=JzWAcFQm5F2XWPpfgHlZt7qi/yfXtUkGUpO5p3QNlisEEk1SE7J2vFK9gRmNy406A7 mXG/uwPJODOvcFxnH/sdJtp2/K5iX0JxMCCmQnn8BDlwzTPyqMyxVAJQcBUfTXe48MjX K1WceT9haBxaTT/lojihfvdwkivgrHbbSTGzeWWauOZbSVTPQ1UvPsdydWsC0zWtrmE2 ECb5OWHixbrzkB88m5n4RYvr3NJELNyz2k9sARN3JObzsOy1MAGbXVBLZiK5OCk6PfGt ybQ24dWaue4DsO4POcLpnPBdET+4/t5n1Dwgm24i+L+YFfFbhEVdKzZu/FC5OejCadMu m/Nw== X-Gm-Message-State: AHQUAuY0mue8b6VF5gOW3jA41fjrttMIYUjYwDDnppYJ+Ck+hIzu9PG+ FOO81FhQRHJTDUoAf8mDatbB/BURBYNzBP1JNA== X-Received: by 2002:ac2:4192:: with SMTP id z18mr1834980lfh.39.1551296382720; Wed, 27 Feb 2019 11:39:42 -0800 (PST) MIME-Version: 1.0 References: <20190215020855.176727-1-sashal@kernel.org> <20190215020855.176727-65-sashal@kernel.org> <20190227175406.GM10616@sasha-vm> In-Reply-To: <20190227175406.GM10616@sasha-vm> From: Pavel Shilovsky Date: Wed, 27 Feb 2019 11:39:31 -0800 Message-ID: Subject: Re: [PATCH AUTOSEL 4.20 65/77] CIFS: Do not assume one credit for async responses To: Sasha Levin Cc: Pavel Shilovskiy , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , Steven French , "linux-cifs@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org =D1=81=D1=80, 27 =D1=84=D0=B5=D0=B2=D1=80. 2019 =D0=B3. =D0=B2 09:54, Sasha= Levin : > > On Fri, Feb 15, 2019 at 08:10:47PM +0000, Pavel Shilovskiy wrote: > >=D1=87=D1=82, 14 =D1=84=D0=B5=D0=B2=D1=80. 2019 =D0=B3. =D0=B2 18:40, Sa= sha Levin : > >> > >> From: Pavel Shilovsky > >> > >> [ Upstream commit 0fd1d37b0501efc6e295f56ab55cdaff784aa50c ] > >> > >> If we don't receive a response we can't assume that the server > >> granted one credit. Assume zero credits in such cases. > >> > >> Signed-off-by: Pavel Shilovsky > >> Reviewed-by: Ronnie Sahlberg > >> Signed-off-by: Steve French > >> Signed-off-by: Sasha Levin > >> --- > >> fs/cifs/smb2pdu.c | 15 +++++++++++---- > >> 1 file changed, 11 insertions(+), 4 deletions(-) > >> > >> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c > >> index d1ae7cdb236d..3c44c51310c4 100644 > >> --- a/fs/cifs/smb2pdu.c > >> +++ b/fs/cifs/smb2pdu.c > >> @@ -2834,9 +2834,10 @@ smb2_echo_callback(struct mid_q_entry *mid) > >> { > >> struct TCP_Server_Info *server =3D mid->callback_data; > >> struct smb2_echo_rsp *rsp =3D (struct smb2_echo_rsp *)mid->res= p_buf; > >> - unsigned int credits_received =3D 1; > >> + unsigned int credits_received =3D 0; > >> > >> - if (mid->mid_state =3D=3D MID_RESPONSE_RECEIVED) > >> + if (mid->mid_state =3D=3D MID_RESPONSE_RECEIVED > >> + || mid->mid_state =3D=3D MID_RESPONSE_MALFORMED) > >> credits_received =3D le16_to_cpu(rsp->sync_hdr.CreditR= equest); > >> > >> DeleteMidQEntry(mid); > >> @@ -3093,7 +3094,7 @@ smb2_readv_callback(struct mid_q_entry *mid) > >> struct TCP_Server_Info *server =3D tcon->ses->server; > >> struct smb2_sync_hdr *shdr =3D > >> (struct smb2_sync_hdr *)rdata->iov[0].= iov_base; > >> - unsigned int credits_received =3D 1; > >> + unsigned int credits_received =3D 0; > >> struct smb_rqst rqst =3D { .rq_iov =3D rdata->iov, > >> .rq_nvec =3D 2, > >> .rq_pages =3D rdata->pages, > >> @@ -3132,6 +3133,9 @@ smb2_readv_callback(struct mid_q_entry *mid) > >> task_io_account_read(rdata->got_bytes); > >> cifs_stats_bytes_read(tcon, rdata->got_bytes); > >> break; > >> + case MID_RESPONSE_MALFORMED: > >> + credits_received =3D le16_to_cpu(shdr->CreditRequest); > >> + /* fall through */ > >> default: > >> if (rdata->result !=3D -ENODATA) > >> rdata->result =3D -EIO; > >> @@ -3325,7 +3329,7 @@ smb2_writev_callback(struct mid_q_entry *mid) > >> struct cifs_tcon *tcon =3D tlink_tcon(wdata->cfile->tlink); > >> unsigned int written; > >> struct smb2_write_rsp *rsp =3D (struct smb2_write_rsp *)mid->r= esp_buf; > >> - unsigned int credits_received =3D 1; > >> + unsigned int credits_received =3D 0; > >> > >> switch (mid->mid_state) { > >> case MID_RESPONSE_RECEIVED: > >> @@ -3353,6 +3357,9 @@ smb2_writev_callback(struct mid_q_entry *mid) > >> case MID_RETRY_NEEDED: > >> wdata->result =3D -EAGAIN; > >> break; > >> + case MID_RESPONSE_MALFORMED: > >> + credits_received =3D le16_to_cpu(rsp->sync_hdr.CreditR= equest); > >> + /* fall through */ > >> default: > >> wdata->result =3D -EIO; > >> break; > >> -- > >> 2.19.1 > >> > > > >Can you also apply the following patch to 4.20.y and 4.19.y, please? > > > >https://patchwork.ozlabs.org/patch/1030180/ > > I'll queue it up for the next cycle as it has dependencies on stable@ > commits that didn't make it in yet and I don't want to mess up with > Greg's flow. Thanks you! It seems that this one has already been merged to 4.20.11: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h= =3Dlinux-4.20.y&id=3D7cb453e5a88169b2a5cec1e00778fc969efd1a77 So, between those two stable kernels only 4.19 doesn't have the patch. -- Best regards, Pavel Shilovsky