From: Pavel Shilovsky <[email protected]>

Signed-off-by: Pavel Shilovsky <[email protected]>
---
 fs/cifs/connect.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 0187f11..62edb10 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3078,6 +3078,18 @@ cifs_negotiate_wsize(struct cifs_tcon *tcon, struct 
smb_vol *pvolume_info)
        unsigned int wsize = pvolume_info->wsize ? pvolume_info->wsize :
                                CIFS_DEFAULT_IOSIZE;
 
+#ifdef CONFIG_CIFS_SMB2
+       if (tcon->ses->server->is_smb2) {
+               wsize = min_t(unsigned int, wsize, server->max_write);
+               /*
+                * limit write size to 2 ** 16, because we don't support
+                * multicredit requests now.
+                */
+               wsize = min_t(unsigned int, wsize, 2 << 15);
+               return wsize;
+       }
+#endif
+
        /* can server support 24-bit write sizes? (via UNIX extensions) */
        if (!tcon->unix_ext || !(unix_cap & CIFS_UNIX_LARGE_WRITE_CAP))
                wsize = min_t(unsigned int, wsize, CIFS_MAX_RFC1002_WSIZE);
@@ -3106,6 +3118,20 @@ cifs_negotiate_rsize(struct cifs_tcon *tcon, struct 
smb_vol *pvolume_info)
        struct TCP_Server_Info *server = tcon->ses->server;
        unsigned int rsize, defsize;
 
+#ifdef CONFIG_CIFS_SMB2
+       if (tcon->ses->server->is_smb2) {
+               rsize = pvolume_info->rsize ? pvolume_info->rsize :
+                       CIFS_DEFAULT_IOSIZE;
+               rsize = min_t(unsigned int, rsize, server->max_read);
+               /*
+                * limit write size to 2 ** 16, because we don't support
+                * multicredit requests now.
+                */
+               rsize = min_t(unsigned int, rsize, 2 << 15);
+               return rsize;
+       }
+#endif
+
        /*
         * Set default value...
         *
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to