* [2.6 patch] dpt_i2o fix for deadlock condition
@ 2005-11-29 16:51 Salyzyn, Mark
2005-11-29 18:04 ` Lennart Sorensen
0 siblings, 1 reply; 3+ messages in thread
From: Salyzyn, Mark @ 2005-11-29 16:51 UTC (permalink / raw)
To: linux-scsi; +Cc: James.Bottomley, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 633 bytes --]
Miquel van Smoorenburg <miquels@cistron.nl> forwarded me this fix to
resolve a deadlock condition that occurs due to the API change in
2.6.13+ kernels dropping the host locking when entering the error
handling. They all end up calling adpt_i2o_post_wait(), which if you
call it unlocked, might return with host_lock locked anyway and that
causes a deadlock.
Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
drivers/scsi/dpt_i2o.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
Patch attached to email due to Outlook corrupting content when inlined.
Sincerely -- Mark Salyzyn
[-- Attachment #2: dpt_i2o.deadlock.patch --]
[-- Type: application/octet-stream, Size: 1999 bytes --]
--- a/drivers/scsi/dpt_i2o.c 2005-11-29 10:34:55.106090160 -0500
+++ b/drivers/scsi/dpt_i2o.c 2005-11-29 11:41:36.924466022 -0500
@@ -660,7 +660,12 @@
msg[2] = 0;
msg[3]= 0;
msg[4] = (u32)cmd;
- if( (rcode = adpt_i2o_post_wait(pHba, msg, sizeof(msg), FOREVER)) != 0){
+ if (pHba->host)
+ spin_lock_irq(pHba->host->host_lock);
+ rcode = adpt_i2o_post_wait(pHba, msg, sizeof(msg), FOREVER);
+ if (pHba->host)
+ spin_unlock_irq(pHba->host->host_lock);
+ if (rcode != 0) {
if(rcode == -EOPNOTSUPP ){
printk(KERN_INFO"%s: Abort cmd not supported\n",pHba->name);
return FAILED;
@@ -697,10 +702,15 @@
msg[2] = 0;
msg[3] = 0;
+ if (pHba->host)
+ spin_lock_irq(pHba->host->host_lock);
old_state = d->state;
d->state |= DPTI_DEV_RESET;
- if( (rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER)) ){
- d->state = old_state;
+ rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER);
+ d->state = old_state;
+ if (pHba->host)
+ spin_unlock_irq(pHba->host->host_lock);
+ if (rcode != 0) {
if(rcode == -EOPNOTSUPP ){
printk(KERN_INFO"%s: Device reset not supported\n",pHba->name);
return FAILED;
@@ -708,7 +718,6 @@
printk(KERN_INFO"%s: Device reset failed\n",pHba->name);
return FAILED;
} else {
- d->state = old_state;
printk(KERN_INFO"%s: Device reset successful\n",pHba->name);
return SUCCESS;
}
@@ -721,6 +730,7 @@
{
adpt_hba* pHba;
u32 msg[4];
+ u32 rcode;
pHba = (adpt_hba*)cmd->device->host->hostdata[0];
memset(msg, 0, sizeof(msg));
@@ -729,7 +739,12 @@
msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[cmd->device->channel].tid);
msg[2] = 0;
msg[3] = 0;
- if(adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER) ){
+ if (pHba->host)
+ spin_lock_irq(pHba->host->host_lock);
+ rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER);
+ if (pHba->host)
+ spin_unlock_irq(pHba->host->host_lock);
+ if (rcode != 0) {
printk(KERN_WARNING"%s: Bus reset failed.\n",pHba->name);
return FAILED;
} else {
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [2.6 patch] dpt_i2o fix for deadlock condition
2005-11-29 16:51 [2.6 patch] dpt_i2o fix for deadlock condition Salyzyn, Mark
@ 2005-11-29 18:04 ` Lennart Sorensen
2005-11-29 18:53 ` Adrian Bunk
0 siblings, 1 reply; 3+ messages in thread
From: Lennart Sorensen @ 2005-11-29 18:04 UTC (permalink / raw)
To: Salyzyn, Mark; +Cc: linux-scsi, James.Bottomley, linux-kernel
On Tue, Nov 29, 2005 at 11:51:25AM -0500, Salyzyn, Mark wrote:
> Miquel van Smoorenburg <miquels@cistron.nl> forwarded me this fix to
> resolve a deadlock condition that occurs due to the API change in
> 2.6.13+ kernels dropping the host locking when entering the error
> handling. They all end up calling adpt_i2o_post_wait(), which if you
> call it unlocked, might return with host_lock locked anyway and that
> causes a deadlock.
>
> Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
>
> drivers/scsi/dpt_i2o.c | 25 ++++++++++++++++++++-----
> 1 file changed, 20 insertions(+), 5 deletions(-)
>
> Patch attached to email due to Outlook corrupting content when inlined.
There must still be a way to tell outlook to make the type something
useful, rather than application/octet-stream. maybe if the extension
was .patch.txt it would do something smarter.
Len Sorensen
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [2.6 patch] dpt_i2o fix for deadlock condition
2005-11-29 18:04 ` Lennart Sorensen
@ 2005-11-29 18:53 ` Adrian Bunk
0 siblings, 0 replies; 3+ messages in thread
From: Adrian Bunk @ 2005-11-29 18:53 UTC (permalink / raw)
To: Lennart Sorensen; +Cc: Salyzyn, Mark, linux-scsi, James.Bottomley, linux-kernel
On Tue, Nov 29, 2005 at 01:04:37PM -0500, Lennart Sorensen wrote:
> On Tue, Nov 29, 2005 at 11:51:25AM -0500, Salyzyn, Mark wrote:
> > Miquel van Smoorenburg <miquels@cistron.nl> forwarded me this fix to
> > resolve a deadlock condition that occurs due to the API change in
> > 2.6.13+ kernels dropping the host locking when entering the error
> > handling. They all end up calling adpt_i2o_post_wait(), which if you
> > call it unlocked, might return with host_lock locked anyway and that
> > causes a deadlock.
> >
> > Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
> >
> > drivers/scsi/dpt_i2o.c | 25 ++++++++++++++++++++-----
> > 1 file changed, 20 insertions(+), 5 deletions(-)
> >
> > Patch attached to email due to Outlook corrupting content when inlined.
>
> There must still be a way to tell outlook to make the type something
> useful, rather than application/octet-stream. maybe if the extension
> was .patch.txt it would do something smarter.
Patches in Attachments aren't nice, but better than corrupted patches.
It's unfortunate, but bitching on the people who are somehow forced to
use crappy email clients is IMHO not a good idea.
> Len Sorensen
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-11-29 18:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-29 16:51 [2.6 patch] dpt_i2o fix for deadlock condition Salyzyn, Mark
2005-11-29 18:04 ` Lennart Sorensen
2005-11-29 18:53 ` Adrian Bunk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®