[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH Linux-2.6.18] scsifront: avoid aquiring same lock twice if ring is full
The locking in scsifront_dev_reset_handler() is obviously wrong. In case of a full ring the host lock is aquired twice. Fixing this issue enables to get rid of the endless fo loop with an explicit break statement. Signed-off-by: Juergen Gross <jgross@xxxxxxxx> --- diff -r 078f1bb69ea5 drivers/xen/scsifront/scsifront.c --- a/drivers/xen/scsifront/scsifront.c Wed Dec 10 10:22:39 2014 +0100 +++ b/drivers/xen/scsifront/scsifront.c Tue Jan 13 14:32:33 2015 +0100 @@ -447,12 +447,10 @@ static int scsifront_dev_reset_handler(s uint16_t rqid; int err = 0; - for (;;) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12) - spin_lock_irq(host->host_lock); + spin_lock_irq(host->host_lock); #endif - if (!RING_FULL(&info->ring)) - break; + while (RING_FULL(&info->ring)) { if (err) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12) spin_unlock_irq(host->host_lock); _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |