From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 265C9350A37; Fri, 13 Feb 2026 13:49:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770990570; cv=none; b=q5cEQuVqpUzsSz3HOpmi3LxGmdUUXQLb2iRX4tqo8b+cT6eBOO4Bbp8jkqAsbslXGOSuTVjWGu30CUJ/Zz5h+xthCri1DOvKgcfyfVaXAD7Pax3AvQf1Yqu9Iw6ebFzM1fj28Toyd8Kjm56vz/RauzLOFImmqC/pfFFUuvyp8r4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770990570; c=relaxed/simple; bh=kfEVif20wPqg9JTbRJSbEK7CEn/9SdSJ0F79LgXu9Wg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HIseeLkhIrP/RCGlYrfRwTHeodMnlPDtojySvg4zWFioJwCBoSZpub+iLweT/DxYySPPO226cnmqnc6RTf9fAkBiQS7KHtFr7T99t2oViIv7x8BMv4lPqMv63wtaocuSBZl6lfzQwy+u0JWPf2RjqomRC491bL/CXeNJxW1aX9c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CTQV7iB0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="CTQV7iB0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49B75C116C6; Fri, 13 Feb 2026 13:49:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770990569; bh=kfEVif20wPqg9JTbRJSbEK7CEn/9SdSJ0F79LgXu9Wg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CTQV7iB0cvwupsn/4+mRLULAwhE7sf3jItyClmaDRwcCLodTbTVyXGMUkEyZ3p+aN +o6blnrqPtvYrD8CwPqPLXKCVWtP4eUjbBMb4anY+JSS5P3yQIVW5K6H4XK6vJiYld ReqmBM1LMZT1hFnaWFsV12iRIcnz9ZAzS8rT00rs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Namjae Jeon , Steve French , Tom Talpey , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, Stefan Metzmacher , Steve French Subject: [PATCH 6.19 10/49] smb: server: let recv_done() queue a refill when the peer is low on credits Date: Fri, 13 Feb 2026 14:47:29 +0100 Message-ID: <20260213134709.103843113@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260213134708.713126210@linuxfoundation.org> References: <20260213134708.713126210@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stefan Metzmacher commit 8106978d400cc88a99fb94927afe8fec7391ca3e upstream. In captures I saw that Windows was granting 191 credits in a batch when its peer posted a lot of messages. We are asking for a credit target of 255 and 191 is 252*3/4. So we also use that logic in order to fill the recv buffers available to the peer. Fixes: a7eef6144c97 ("smb: server: queue post_recv_credits_work in put_recvmsg() and avoid count_avail_recvmsg") Cc: # 6.18.x Cc: Namjae Jeon Cc: Steve French Cc: Tom Talpey Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Signed-off-by: Stefan Metzmacher Acked-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/smb/server/transport_rdma.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/fs/smb/server/transport_rdma.c +++ b/fs/smb/server/transport_rdma.c @@ -644,6 +644,7 @@ static void recv_done(struct ib_cq *cq, struct smbdirect_data_transfer *data_transfer = (struct smbdirect_data_transfer *)recvmsg->packet; u32 remaining_data_length, data_offset, data_length; + int current_recv_credits; u16 old_recv_credit_target; if (wc->byte_len < @@ -682,7 +683,7 @@ static void recv_done(struct ib_cq *cq, } atomic_dec(&sc->recv_io.posted.count); - atomic_dec(&sc->recv_io.credits.count); + current_recv_credits = atomic_dec_return(&sc->recv_io.credits.count); old_recv_credit_target = sc->recv_io.credits.target; sc->recv_io.credits.target = @@ -702,7 +703,8 @@ static void recv_done(struct ib_cq *cq, wake_up(&sc->send_io.credits.wait_queue); if (data_length) { - if (sc->recv_io.credits.target > old_recv_credit_target) + if (current_recv_credits <= (sc->recv_io.credits.target / 4) || + sc->recv_io.credits.target > old_recv_credit_target) queue_work(sc->workqueue, &sc->recv_io.posted.refill_work); enqueue_reassembly(sc, recvmsg, (int)data_length);