]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
sunvdc: Do not spin in an infinite loop when vio_ldc_send() returns EAGAIN
authorYoung Xiao <YangX92@hotmail.com>
Wed, 28 Nov 2018 12:36:39 +0000 (12:36 +0000)
committerJens Axboe <axboe@kernel.dk>
Wed, 28 Nov 2018 13:23:12 +0000 (06:23 -0700)
__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>
drivers/block/sunvdc.c

index 175a646196022247520ad9c1e318d75b82662866..9c0553dd13e7c391763cbbaac989844ec9e87821 100644 (file)
@@ -45,6 +45,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 {
@@ -431,6 +433,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;
@@ -443,6 +446,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)