]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.18-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Jan 2019 10:14:59 +0000 (11:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Jan 2019 10:14:59 +0000 (11:14 +0100)
added patches:
cifs-fix-possible-hang-during-async-mtu-reads-and-writes.patch

queue-3.18/cifs-fix-possible-hang-during-async-mtu-reads-and-writes.patch [new file with mode: 0644]
queue-3.18/series

diff --git a/queue-3.18/cifs-fix-possible-hang-during-async-mtu-reads-and-writes.patch b/queue-3.18/cifs-fix-possible-hang-during-async-mtu-reads-and-writes.patch
new file mode 100644 (file)
index 0000000..7f15933
--- /dev/null
@@ -0,0 +1,55 @@
+From acc58d0bab55a50e02c25f00bd6a210ee121595f Mon Sep 17 00:00:00 2001
+From: Pavel Shilovsky <pshilov@microsoft.com>
+Date: Thu, 17 Jan 2019 08:21:24 -0800
+Subject: CIFS: Fix possible hang during async MTU reads and writes
+
+From: Pavel Shilovsky <pshilov@microsoft.com>
+
+commit acc58d0bab55a50e02c25f00bd6a210ee121595f upstream.
+
+When doing MTU i/o we need to leave some credits for
+possible reopen requests and other operations happening
+in parallel. Currently we leave 1 credit which is not
+enough even for reopen only: we need at least 2 credits
+if durable handle reconnect fails. Also there may be
+other operations at the same time including compounding
+ones which require 3 credits at a time each. Fix this
+by leaving 8 credits which is big enough to cover most
+scenarios.
+
+Was able to reproduce this when server was configured
+to give out fewer credits than usual.
+
+The proper fix would be to reconnect a file handle first
+and then obtain credits for an MTU request but this leads
+to bigger code changes and should happen in other patches.
+
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/cifs/smb2ops.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/fs/cifs/smb2ops.c
++++ b/fs/cifs/smb2ops.c
+@@ -143,14 +143,14 @@ smb2_wait_mtu_credits(struct TCP_Server_
+                       scredits = server->credits;
+                       /* can deadlock with reopen */
+-                      if (scredits == 1) {
++                      if (scredits <= 8) {
+                               *num = SMB2_MAX_BUFFER_SIZE;
+                               *credits = 0;
+                               break;
+                       }
+-                      /* leave one credit for a possible reopen */
+-                      scredits--;
++                      /* leave some credits for reopen and other ops */
++                      scredits -= 8;
+                       *num = min_t(unsigned int, size,
+                                    scredits * SMB2_MAX_BUFFER_SIZE);
index 07dc24fa4d4e41b53515f8c2ad448116d5888b53..5d0e6eb7a64ea19786e8523697c8ec3d1119cea6 100644 (file)
@@ -5,3 +5,4 @@ s390-smp-fix-cpu-hotplug-deadlock-with-cpu-rescan.patch
 staging-rtl8188eu-add-device-code-for-d-link-dwa-121-rev-b1.patch
 tty-handle-problem-if-line-discipline-does-not-have-receive_buf.patch
 tty-n_hdlc-fix-__might_sleep-warning.patch
+cifs-fix-possible-hang-during-async-mtu-reads-and-writes.patch