/[linux-patches]/genpatches-2.6/trunk/2.6.14/1163_5_dpt_i20-deadlock.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.14/1163_5_dpt_i20-deadlock.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 292 - (show annotations) (download) (as text)
Tue Jan 31 21:50:53 2006 UTC (14 years, 8 months ago) by johnm
File MIME type: text/x-diff
File size: 3091 byte(s)
Large update - thanks goes to Kerin Millar for the legwork.
1 From: Salyzyn, Mark <mark_salyzyn@adaptec.com>
2 Date: Sun, 18 Dec 2005 03:26:30 +0000 (-0800)
3 Subject: [PATCH] dpt_i2o fix for deadlock condition
4 X-Git-Url: http://kernel.org/git/?p=linux/kernel/git/gregkh/linux-2.6.14.y.git;a=commitdiff;h=fe2e17a405a58ec8a7138fee4ebe101858b636e0
5
6 [PATCH] dpt_i2o fix for deadlock condition
7
8 Miquel van Smoorenburg <miquels@cistron.nl> forwarded me this fix to
9 resolve a deadlock condition that occurs due to the API change in 2.6.13+
10 kernels dropping the host locking when entering the error handling. They
11 all end up calling adpt_i2o_post_wait(), which if you call it unlocked,
12 might return with host_lock locked anyway and that causes a deadlock.
13
14 Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
15 Cc: James Bottomley <James.Bottomley@steeleye.com>
16 Cc: <stable@kernel.org>
17 Signed-off-by: Andrew Morton <akpm@osdl.org>
18 Signed-off-by: Chris Wright <chrisw@redhat.com>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
20 ---
21
22 --- a/drivers/scsi/dpt_i2o.c
23 +++ b/drivers/scsi/dpt_i2o.c
24 @@ -660,7 +660,12 @@ static int adpt_abort(struct scsi_cmnd *
25 msg[2] = 0;
26 msg[3]= 0;
27 msg[4] = (u32)cmd;
28 - if( (rcode = adpt_i2o_post_wait(pHba, msg, sizeof(msg), FOREVER)) != 0){
29 + if (pHba->host)
30 + spin_lock_irq(pHba->host->host_lock);
31 + rcode = adpt_i2o_post_wait(pHba, msg, sizeof(msg), FOREVER);
32 + if (pHba->host)
33 + spin_unlock_irq(pHba->host->host_lock);
34 + if (rcode != 0) {
35 if(rcode == -EOPNOTSUPP ){
36 printk(KERN_INFO"%s: Abort cmd not supported\n",pHba->name);
37 return FAILED;
38 @@ -697,10 +702,15 @@ static int adpt_device_reset(struct scsi
39 msg[2] = 0;
40 msg[3] = 0;
41
42 + if (pHba->host)
43 + spin_lock_irq(pHba->host->host_lock);
44 old_state = d->state;
45 d->state |= DPTI_DEV_RESET;
46 - if( (rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER)) ){
47 - d->state = old_state;
48 + rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER);
49 + d->state = old_state;
50 + if (pHba->host)
51 + spin_unlock_irq(pHba->host->host_lock);
52 + if (rcode != 0) {
53 if(rcode == -EOPNOTSUPP ){
54 printk(KERN_INFO"%s: Device reset not supported\n",pHba->name);
55 return FAILED;
56 @@ -708,7 +718,6 @@ static int adpt_device_reset(struct scsi
57 printk(KERN_INFO"%s: Device reset failed\n",pHba->name);
58 return FAILED;
59 } else {
60 - d->state = old_state;
61 printk(KERN_INFO"%s: Device reset successful\n",pHba->name);
62 return SUCCESS;
63 }
64 @@ -721,6 +730,7 @@ static int adpt_bus_reset(struct scsi_cm
65 {
66 adpt_hba* pHba;
67 u32 msg[4];
68 + u32 rcode;
69
70 pHba = (adpt_hba*)cmd->device->host->hostdata[0];
71 memset(msg, 0, sizeof(msg));
72 @@ -729,7 +739,12 @@ static int adpt_bus_reset(struct scsi_cm
73 msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[cmd->device->channel].tid);
74 msg[2] = 0;
75 msg[3] = 0;
76 - if(adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER) ){
77 + if (pHba->host)
78 + spin_lock_irq(pHba->host->host_lock);
79 + rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER);
80 + if (pHba->host)
81 + spin_unlock_irq(pHba->host->host_lock);
82 + if (rcode != 0) {
83 printk(KERN_WARNING"%s: Bus reset failed.\n",pHba->name);
84 return FAILED;
85 } else {

  ViewVC Help
Powered by ViewVC 1.1.20