Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3322282pxf; Mon, 15 Mar 2021 07:07:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1x6nn5wuHxkblADaJ2BFuEpuwbORVC6xt5MllWfQlVsuK4j/6hp/EZLdR2tEk8qycJ9qN X-Received: by 2002:a17:906:bd2:: with SMTP id y18mr23877117ejg.482.1615817240143; Mon, 15 Mar 2021 07:07:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615817240; cv=none; d=google.com; s=arc-20160816; b=caxxTGifbrE+OGF1peJZnDLoCVBleBafbybT7+6GD6hKho8duflaww8LTeS3iQ6yar yv2LiNuRVhH0p15xNqjRbT70GAwdFsPQgGssin640ROi/JbdrmNEgFNWXKSGMH1rsT5D mlxByE5aBK+ictPWiBuI3aZhKZpUZPV+voA6HLANlJ5icE9sP1hnYOiJQInDTKNNsC4t NVeK+sIBJy1fa3BH6jEJTtVyflkXKT51T/Ya5N3gHH3kL5CJe055bkMcOhuTY7EVdfkX pvuffFt1VLXCjbXX78OziWMooClRc+y69KbSqOzdMYhAxWBHtzM9hBLS0/kVDk9/LtCE mybw== 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=s9q69XG/xbrOr/aYdrHLngmCbLoQz2UXi+BthQqsPcE=; b=aXz13aL1Y4OhFYT/CBlm1H44vydYy7cjllMzjmq3zUbIMJeJu21Wfu8SHKf7vA++g+ hnFtGXPJmVHkAp0C21EroInoGv9xQ8Jx3x1pzQI9gyNng8x5VzBGTTpj8REL5SxZIi77 apfAtg3DN6n/KVKSupaz71ggq6XzUJmH2Rw1nUMEC3MqH+B3cSycglrbPsR36YR6pm33 yDw3C668uobsgbC6wohEma1Miu20qugQkvk96doDgfNQjVEtSCekMHlAe0KqV+RfWG94 jKlIJaJUKLBXrlERalIyVE45eqvXgbsgNV+hkJ3arui4HbPXt9CAakkunPjNxU7jvkgn M3iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="XJF/2ysi"; 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 dc3si11555831edb.57.2021.03.15.07.06.54; Mon, 15 Mar 2021 07:07: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="XJF/2ysi"; 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 S233131AbhCOOFH (ORCPT + 99 others); Mon, 15 Mar 2021 10:05:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:34534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231983AbhCON51 (ORCPT ); Mon, 15 Mar 2021 09:57:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7365264DAD; Mon, 15 Mar 2021 13:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816647; bh=hkkl8bLmIp1Yh4LBayoLD0RW3RsbGjJ000u/KnO1o8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XJF/2ysirqp7/e5secQyrJZauuyxcqckIhxYE9HjOAuvAKqnSR6Hd/uKkPCC2Hg+3 Tu4f9F/wu1z4CcYQvIiSFMZvjT6xgbSUl+JrvwIQ/oJReBlB6MVGS2OVk/gNsBQ9Kf qRvmipccxnkuyJCkYmAJaKqVJFGGnKe4QznpZ+lw= 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.11 040/306] cifs: fix credit accounting for extra channel Date: Mon, 15 Mar 2021 14:51:43 +0100 Message-Id: <20210315135508.996723064@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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 @@ -1405,6 +1405,11 @@ smbd_connected: tcp_ses->min_offload = ctx->min_offload; tcp_ses->tcpStatus = CifsNeedNegotiate; + if ((ctx->max_credits < 20) || (ctx->max_credits > 60000)) + tcp_ses->max_credits = SMB2_MAX_CREDITS_AVAILABLE; + else + tcp_ses->max_credits = ctx->max_credits; + tcp_ses->nr_targets = 1; tcp_ses->ignore_signature = ctx->ignore_signature; /* thread spawned, put it on the list */ @@ -2806,11 +2811,6 @@ static int mount_get_conns(struct smb3_f *nserver = server; - if ((ctx->max_credits < 20) || (ctx->max_credits > 60000)) - server->max_credits = SMB2_MAX_CREDITS_AVAILABLE; - else - server->max_credits = ctx->max_credits; - /* get a reference to a SMB session */ ses = cifs_get_smb_ses(server, ctx); if (IS_ERR(ses)) { --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -230,6 +230,7 @@ cifs_ses_add_channel(struct cifs_sb_info ctx.noautotune = ses->server->noautotune; ctx.sockopt_tcp_nodelay = ses->server->tcp_nodelay; ctx.echo_interval = ses->server->echo_interval / HZ; + ctx.max_credits = ses->server->max_credits; /* * This will be used for encoding/decoding user/domain/pw