Whamcloud - gitweb
EX-994 kernel: backport a virtio bug fix to lustre kernel
authorWang Shilong <wshilong@ddn.com>
Wed, 8 Apr 2020 13:04:13 +0000 (21:04 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 6 Mar 2021 09:14:56 +0000 (09:14 +0000)
backport following commit to RHEL7 kernel, as the bug
is frequently hit on heavy testing:

scsi: virtio: Reduce BUG if total_sg > virtqueue size to WARN.

If using indirect descriptors, you can make the total_sg as large as you
want.  If not, BUG is too serious because the function later returns
-ENOSPC.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Linux-commit: 44ed8089e991a60d614abe0ee4b9057a28b364e4

Change-Id: I237b5cfc4215093346224c8d0ba8a69541bf7694
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/38230
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/41837
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Andreas Dilger <adilger@whamcloud.com>
lustre/kernel_patches/patches/virtio-Reduce-BUG-if-total_sg-virtqueue-size-to-rhel7.patch [new file with mode: 0644]
lustre/kernel_patches/series/3.10-rhel7.7.series

diff --git a/lustre/kernel_patches/patches/virtio-Reduce-BUG-if-total_sg-virtqueue-size-to-rhel7.patch b/lustre/kernel_patches/patches/virtio-Reduce-BUG-if-total_sg-virtqueue-size-to-rhel7.patch
new file mode 100644 (file)
index 0000000..26be76e
--- /dev/null
@@ -0,0 +1,44 @@
+From 44ed8089e991a60d614abe0ee4b9057a28b364e4 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Thu, 10 Aug 2017 17:56:51 +0100
+Subject: [PATCH] scsi: virtio: Reduce BUG if total_sg > virtqueue size to
+ WARN.
+
+If using indirect descriptors, you can make the total_sg as large as you
+want.  If not, BUG is too serious because the function later returns
+-ENOSPC.
+
+Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
+Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+---
+ drivers/virtio/virtio_ring.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
+index 5e1b548828e6..27cbc1eab868 100644
+--- a/drivers/virtio/virtio_ring.c
++++ b/drivers/virtio/virtio_ring.c
+@@ -296,7 +296,6 @@ static inline int virtqueue_add(struct virtqueue *_vq,
+       }
+ #endif
+-      BUG_ON(total_sg > vq->vring.num);
+       BUG_ON(total_sg == 0);
+       head = vq->free_head;
+@@ -305,8 +304,10 @@ static inline int virtqueue_add(struct virtqueue *_vq,
+        * buffers, then go indirect. FIXME: tune this threshold */
+       if (vq->indirect && total_sg > 1 && vq->vq.num_free)
+               desc = alloc_indirect(_vq, total_sg, gfp);
+-      else
++      else {
+               desc = NULL;
++              WARN_ON_ONCE(total_sg > vq->vring.num && !vq->indirect);
++      }
+       if (desc) {
+               /* Use a single buffer which doesn't continue */
+-- 
+2.25.2
+
index 5fb9308..9b4ee1e 100644 (file)
@@ -8,3 +8,4 @@ block-pass-bio-into-integrity_processing_fn-rhel7.patch
 block-Ensure-we-only-enable-integrity-metadata-for-reads-and-writes-rhel7.patch
 blk-mq-insert-rq-with-DONTPREP-to-hctx-dispatch-rhel7.patch
 block-Don-t-merge-requests-if-integrity-flags-rhel7.patch
+virtio-Reduce-BUG-if-total_sg-virtqueue-size-to-rhel7.patch