Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3519380pxf; Mon, 15 Mar 2021 11:21:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmEJZFcnwQ9Ifm/AkT4ZGpiB5xlly0lOX2GRrkFJxan52o/+wZil0zDKQfDqm5c78qh0wd X-Received: by 2002:a17:906:1f93:: with SMTP id t19mr25746344ejr.443.1615832480555; Mon, 15 Mar 2021 11:21:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832480; cv=none; d=google.com; s=arc-20160816; b=QUboaCx9Ki5amZ0ilaINddLzgujJDEJI7AXmpQL1u0Dhtnl16PinEqxfZl0zrrDogH 4nZvSr5jYVlw4S4Cq3RzIg6rrubYYpgxPbpzXFLLaR/LZ1OS7Ke1X+jbWgPAQCCddTDx NhPIxEZJkZln0ejQJH2jDtiAHS84HnNbw+zQ09Vqq52ajoqF7VEUEqdv+TVgJ7XdiLDu 2rh+wRX8Pwuih1MvHAoJhzMdYp2ikBDU/pMm0YNG09xpdcUb1W+zmRrG+uAxiHyFpqQC 2PKDP+hQX1VZLN2bgBUtMQgJuvfJYJUz/7kCQQDf+aeedTzaCF4/KU2PgW55VDsDFQwI B+uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qEQirVj3lKlDSMgMwOU8/8Ut1+Wn9JMRvBoXrfg/tCo=; b=VYQ4yteRVyKTMpmaFSptJP4Ivif5fSndOZqSVehMGQ39Au1SNuNOy52ToJgr+aA95O U9T3g0MNspwn9IMdkqOKeh0vtXjfrTmVLHJOCZy4fCA+dT1CL171airNRnIJYJ/sgkV3 GAhtsaDY1MuB1qXpunzcmGE4FxM/m/7PGaylLAOew+GYPNMIfbHy4Bab3SGKgnQmfrGu Ivd5aJDKq9uNSGMioII5rr5OG2jSH2CBSxcKn3Xi7ci0kMV09N2X+JpXNBYAdLXoJ39J xXKzpnUaCVEovcFOM+6RZ087Y7PF0PsUIWMKWHvaU1m2IFot+TaVUmNXsOUpS0UAVpBZ W9gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f8MiS2zs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r21si10818188edw.605.2021.03.15.11.20.57; Mon, 15 Mar 2021 11:21:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f8MiS2zs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237732AbhCOOTt (ORCPT + 99 others); Mon, 15 Mar 2021 10:19:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:37522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232685AbhCON7x (ORCPT ); Mon, 15 Mar 2021 09:59:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A0F5164F1A; Mon, 15 Mar 2021 13:59:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816774; bh=5EHHy+RI8mq93sT8v8wO7Z8g+xB42XGaRZ8h7umuZbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f8MiS2zsLGQZ4E7kd4VuBAxUxv05LoZBDThBI/Oi/ectpgwj5sqkBlN8dkFw5iOdr vT54vWzjOJ3AJ0Sd3Pa1TaNJhmIiKdsF3td/ATZaKbJN5DJSs4LXu58qWtOT1SbbkI j0Fj1558Mol/fzs0wgf1D257P9ANNerVl96IzH6g= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aurelien Aptel , Shyam Prasad N , Steve French Subject: [PATCH 5.10 107/290] cifs: fix credit accounting for extra channel Date: Mon, 15 Mar 2021 14:53:20 +0100 Message-Id: <20210315135545.522200360@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Aurelien Aptel commit a249cc8bc2e2fed680047d326eb9a50756724198 upstream. With multichannel, operations like the queries from "ls -lR" can cause all credits to be used and errors to be returned since max_credits was not being set correctly on the secondary channels and thus the client was requesting 0 credits incorrectly in some cases (which can lead to not having enough credits to perform any operation on that channel). Signed-off-by: Aurelien Aptel CC: # v5.8+ Reviewed-by: Shyam Prasad N Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/connect.c | 10 +++++----- fs/cifs/sess.c | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2629,6 +2629,11 @@ smbd_connected: tcp_ses->min_offload = volume_info->min_offload; tcp_ses->tcpStatus = CifsNeedNegotiate; + if ((volume_info->max_credits < 20) || (volume_info->max_credits > 60000)) + tcp_ses->max_credits = SMB2_MAX_CREDITS_AVAILABLE; + else + tcp_ses->max_credits = volume_info->max_credits; + tcp_ses->nr_targets = 1; tcp_ses->ignore_signature = volume_info->ignore_signature; /* thread spawned, put it on the list */ @@ -4077,11 +4082,6 @@ static int mount_get_conns(struct smb_vo *nserver = server; - if ((vol->max_credits < 20) || (vol->max_credits > 60000)) - server->max_credits = SMB2_MAX_CREDITS_AVAILABLE; - else - server->max_credits = vol->max_credits; - /* get a reference to a SMB session */ ses = cifs_get_smb_ses(server, vol); if (IS_ERR(ses)) { --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -224,6 +224,7 @@ cifs_ses_add_channel(struct cifs_ses *se vol.noautotune = ses->server->noautotune; vol.sockopt_tcp_nodelay = ses->server->tcp_nodelay; vol.echo_interval = ses->server->echo_interval / HZ; + vol.max_credits = ses->server->max_credits; /* * This will be used for encoding/decoding user/domain/pw