summaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorYoung Xiao <YangX92@hotmail.com>2018-11-28 12:36:39 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-12 19:46:00 +0100
commit7ab4b6526fdcdfa7772984bbcd2ac4fd14fa223b (patch)
tree2b2906efc5b6683c4611e2b20cb8ca7ca07c1f56 /drivers/block
parent8f6e8dbc8f3652131765668660cf4b57780df010 (diff)
downloadlinux-stable-7ab4b6526fdcdfa7772984bbcd2ac4fd14fa223b.tar.gz
linux-stable-7ab4b6526fdcdfa7772984bbcd2ac4fd14fa223b.tar.bz2
linux-stable-7ab4b6526fdcdfa7772984bbcd2ac4fd14fa223b.zip
sunvdc: Do not spin in an infinite loop when vio_ldc_send() returns EAGAIN
[ Upstream commit a11f6ca9aef989b56cd31ff4ee2af4fb31a172ec ] __vdc_tx_trigger should only loop on EAGAIN a finite number of times. See commit adddc32d6fde ("sunvnet: Do not spin in an infinite loop when vio_ldc_send() returns EAGAIN") for detail. Signed-off-by: Young Xiao <YangX92@hotmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/sunvdc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index ad9749463d4f..ed4d6276e94f 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -41,6 +41,8 @@ MODULE_VERSION(DRV_MODULE_VERSION);
#define WAITING_FOR_GEN_CMD 0x04
#define WAITING_FOR_ANY -1
+#define VDC_MAX_RETRIES 10
+
static struct workqueue_struct *sunvdc_wq;
struct vdc_req_entry {
@@ -427,6 +429,7 @@ static int __vdc_tx_trigger(struct vdc_port *port)
.end_idx = dr->prod,
};
int err, delay;
+ int retries = 0;
hdr.seq = dr->snd_nxt;
delay = 1;
@@ -439,6 +442,8 @@ static int __vdc_tx_trigger(struct vdc_port *port)
udelay(delay);
if ((delay <<= 1) > 128)
delay = 128;
+ if (retries++ > VDC_MAX_RETRIES)
+ break;
} while (err == -EAGAIN);
if (err == -ENOTCONN)