diff mbox series

[SMB3] request more credits during session setup

Message ID CAH2r5muwi0BSpU7jujroojVNM6qO8pRO_mXTBA4TpSsp2Cd=5A@mail.gmail.com (mailing list archive)
State New, archived
Headers show
Series [SMB3] request more credits during session setup | expand

Commit Message

Steve French Feb. 14, 2019, 7:27 a.m. UTC
We only request significantly more credits (during mount) on first
session setup so we typically end up with from 43-49 credits available
when mount completes - which is not enough for a large I/O to complete
(if started soon after mount).  We need > 64 credits.   Solve this by
requesting more than 2 credits on tree connect.

After mount (before this patch):
43 credits (not enough for a 4MB I/O)

After mount (with this patch)
105 credits (which is good, enough for two large I/Os to be issued
immediately after mount)

Comments

Ronnie Sahlberg Feb. 14, 2019, 8:05 a.m. UTC | #1
In libsmb2 I am very aggressive about requesting credits during early session establish without problems
so I am confident we could even dial this up to say 1000 credits.

Though  105 might be more than sufficient.

----- Original Message -----
From: "Steve French" <smfrench@gmail.com>
To: "CIFS" <linux-cifs@vger.kernel.org>
Sent: Thursday, 14 February, 2019 5:27:41 PM
Subject: [SMB3][PATCH] request more credits during session setup

We only request significantly more credits (during mount) on first
session setup so we typically end up with from 43-49 credits available
when mount completes - which is not enough for a large I/O to complete
(if started soon after mount).  We need > 64 credits.   Solve this by
requesting more than 2 credits on tree connect.

After mount (before this patch):
43 credits (not enough for a 4MB I/O)

After mount (with this patch)
105 credits (which is good, enough for two large I/Os to be issued
immediately after mount)
Steve French Feb. 14, 2019, 4:30 p.m. UTC | #2
smbclient requests even more for every request - although server will
give out a much, much smaller number in reponse.  If there were
another safe request to add more to (perhaps validate negotiate) we
should be up to a reasonable number of credits even for parallel i/o
right after mount - in any case it will increase over time (the number
of credits) but perhaps we should more aggressively ask for credits on
each request and go from asking for 2 for all non read/write requests
to asking for 64 or 128

On Thu, Feb 14, 2019 at 2:05 AM Ronnie Sahlberg <lsahlber@redhat.com> wrote:
>
> In libsmb2 I am very aggressive about requesting credits during early session establish without problems
> so I am confident we could even dial this up to say 1000 credits.
>
> Though  105 might be more than sufficient.
>
> ----- Original Message -----
> From: "Steve French" <smfrench@gmail.com>
> To: "CIFS" <linux-cifs@vger.kernel.org>
> Sent: Thursday, 14 February, 2019 5:27:41 PM
> Subject: [SMB3][PATCH] request more credits during session setup
>
> We only request significantly more credits (during mount) on first
> session setup so we typically end up with from 43-49 credits available
> when mount completes - which is not enough for a large I/O to complete
> (if started soon after mount).  We need > 64 credits.   Solve this by
> requesting more than 2 credits on tree connect.
>
> After mount (before this patch):
> 43 credits (not enough for a 4MB I/O)
>
> After mount (with this patch)
> 105 credits (which is good, enough for two large I/Os to be issued
> immediately after mount)
>
>
> --
> Thanks,
>
> Steve
Pavel Shilovsky Feb. 14, 2019, 5:41 p.m. UTC | #3
чт, 14 февр. 2019 г. в 08:59, Steve French <smfrench@gmail.com>:
>
> We only request significantly more credits (during mount) on first
> session setup so we typically end up with from 43-49 credits available
> when mount completes - which is not enough for a large I/O to complete
> (if started soon after mount).  We need > 64 credits.   Solve this by
> requesting more than 2 credits on tree connect.
>
> After mount (before this patch):
> 43 credits (not enough for a 4MB I/O)
>
> After mount (with this patch)
> 105 credits (which is good, enough for two large I/Os to be issued
> immediately after mount)
>

Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>

--
Best regards,
Pavel Shilovsky
diff mbox series

Patch

From 375808983c63e25f8e0d05effab86b0f36a024b7 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Thu, 14 Feb 2019 01:19:02 -0600
Subject: [PATCH 1/2] smb3: request more credits on tree connect

If we try large I/O (read or write) immediately after mount
we won't typically have enough credits because we only request
large amounts of credits on the first session setup.  So if
large I/O is attempted soon after mount we will typically only
have about 43 credits rather than 105 credits (with this patch)
available for the large i/o (which needs 64 credits minimum).

This patch requests more credits during tree connect, which
helps ensure that we have enough credits when mount completes
(between these requests and the first session setup) in order
 to start large I/O immediately after mount if needed.
---
 fs/cifs/smb2pdu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index e3f0775f9765..49c2843b1bcf 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1620,6 +1620,9 @@  SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
 	rqst.rq_iov = iov;
 	rqst.rq_nvec = 2;
 
+	/* Need 64 for max size write so ask for more in case not there yet */
+	req->sync_hdr.CreditRequest = cpu_to_le16(64);
+
 	rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);
 	cifs_small_buf_release(req);
 	rsp = (struct smb2_tree_connect_rsp *)rsp_iov.iov_base;
-- 
2.17.1