linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [SMB3][PATCH] request more credits during session setup
@ 2019-02-14  7:27 Steve French
  2019-02-14  8:05 ` Ronnie Sahlberg
  2019-02-14 17:41 ` Pavel Shilovsky
  0 siblings, 2 replies; 4+ messages in thread
From: Steve French @ 2019-02-14  7:27 UTC (permalink / raw)
  To: CIFS

[-- Attachment #1: Type: text/plain, Size: 543 bytes --]

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

[-- Attachment #2: 0001-smb3-request-more-credits-on-tree-connect.patch --]
[-- Type: text/x-patch, Size: 1470 bytes --]

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [SMB3][PATCH] request more credits during session setup
  2019-02-14  7:27 [SMB3][PATCH] request more credits during session setup Steve French
@ 2019-02-14  8:05 ` Ronnie Sahlberg
  2019-02-14 16:30   ` Steve French
  2019-02-14 17:41 ` Pavel Shilovsky
  1 sibling, 1 reply; 4+ messages in thread
From: Ronnie Sahlberg @ 2019-02-14  8:05 UTC (permalink / raw)
  To: Steve French; +Cc: CIFS

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [SMB3][PATCH] request more credits during session setup
  2019-02-14  8:05 ` Ronnie Sahlberg
@ 2019-02-14 16:30   ` Steve French
  0 siblings, 0 replies; 4+ messages in thread
From: Steve French @ 2019-02-14 16:30 UTC (permalink / raw)
  To: Ronnie Sahlberg; +Cc: CIFS

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



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [SMB3][PATCH] request more credits during session setup
  2019-02-14  7:27 [SMB3][PATCH] request more credits during session setup Steve French
  2019-02-14  8:05 ` Ronnie Sahlberg
@ 2019-02-14 17:41 ` Pavel Shilovsky
  1 sibling, 0 replies; 4+ messages in thread
From: Pavel Shilovsky @ 2019-02-14 17:41 UTC (permalink / raw)
  To: Steve French; +Cc: CIFS

чт, 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-14 17:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-14  7:27 [SMB3][PATCH] request more credits during session setup Steve French
2019-02-14  8:05 ` Ronnie Sahlberg
2019-02-14 16:30   ` Steve French
2019-02-14 17:41 ` Pavel Shilovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).