[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] xen-scsifront: don't deadlock if the ring becomes full



scsifront_action_handler() will deadlock on host->host_lock, if the
ring is full and it has to wait for entries to become available.

Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>
---
This was found with sparse. I've not tested it.
---
 drivers/scsi/xen-scsifront.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index 7e88659..cc14c8d 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -541,8 +541,9 @@ static int scsifront_action_handler(struct scsi_cmnd *sc, 
uint8_t act)
        if (!shadow)
                return FAILED;
 
+       spin_lock_irq(host->host_lock);
+
        for (;;) {
-               spin_lock_irq(host->host_lock);
                if (!RING_FULL(&info->ring)) {
                        ring_req = scsifront_command2ring(info, sc, shadow);
                        if (ring_req)
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.