scsifront: avoid acquiring same lock twice if ring is full
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 42 lines · On 01/14/2015 11:22 AM, Xen patchbot-linux-2.6.18-xen wrote:
# HG changeset patch
# User Juergen Gross <[email protected]>
# Date 1421228828 -3600
# Node ID3015a92b2b53825d00dc81c2dd131fc77ce8ab00# Parent078f1bb69ea5e3772f3df4b4ee21f3c52e381e51
scsifront: avoid acquiring same lock twice if ring is fullThe locking in
scsifront_dev_reset_handler()as introduced by c/s 1209:4d1471ca031e is obviously wrong. In case of a full ring the host lock is acquired twice.Fixing this issue enables to get rid of the endless fo loop with an explicit break statement.
Signed-off-by Juergen Gross <[email protected]>Also add a missing version check.
Signed-off-by Jan Beulich <[email protected]>Committed-by Jan Beulich <[email protected]>---
diff -r
078f1bb69ea5-r3015a92b2b53drivers/xen/scsifront/scsifront.cdrivers/xen/scsifront/scsifront.c +2
-4@@ -447,12 +447,10 @@ static int scsifront_dev_reset_handler(suint16_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);
drivers/xen/scsifront/scsifront.c static int scsifront_dev_reset_handler(s · line 464
Quoted 4 lines
drivers/xen/scsifront/scsifront.c +1
-0@@ -463,7 +461,9 @@ static int scsifront_dev_reset_handler(sspin_unlock_irq (host->host_lock); err =wait_event_interruptible (info->wq_sync, !info->waiting_sync); +#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,12 )
Is this correct? I didn't check, but thought up to 2.6.12 the reset handler would be called with the lock already held.
In any case: either this test must be removed again or two lines above another test should be added for the unlock.
Juergen
Quoted 11 lines
drivers/xen/scsifront/scsifront.c +1
-0spin_lock_irq (host->host_lock); +#endif } ring_req =scsifront_pre_request (info);_______________________________________________
Xen-changelog mailing list
[email protected]
http://lists.xensource.com/xen-changelog
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 14.01.15 at 11:36, <[email protected]> wrote:
Review static int scsifront_dev_reset_handler(s · line 464
Quoted 5 lines · On 01/14/2015 11:22 AM, Xen patchbot-linux-2.6.18-xen wrote:
(quoted diff) +1
-0@@ -463,7 +461,9 @@ static int scsifront_dev_reset_handler(s spin_unlock_irq(host->host_lock); err = wait_event_interruptible(info->wq_sync, !info->waiting_sync); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)Is this correct? I didn't check, but thought up to 2.6.12 the reset handler would be called with the lock already held.
Quoted 2 lines
In any case: either this test must be removed again or two lines above another test should be added for the unlock.
Indeed, I didn't look closely enough - will revert that addition.
Jan