/[linux-patches]/genpatches-2.6/trunk/2.6.14/1052_4_libata-locking-rewrite.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.14/1052_4_libata-locking-rewrite.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 232 - (show annotations) (download) (as text)
Thu Dec 15 16:22:43 2005 UTC (14 years, 11 months ago) by dsd
File MIME type: text/x-diff
File size: 2223 byte(s)
Linux 2.6.14.4
1 From stable-bounces@linux.kernel.org Mon Dec 12 12:27:15 2005
2 Date: Mon, 31 Oct 2005 09:05:36 -0800
3 Message-Id: <200510311705.j9VH5aDM031690@hera.kernel.org>
4 From: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
5 To: git-commits-head@vger.kernel.org
6 Cc:
7 Subject: libata: locking rewrite (== fix)
8
9 From: Jeff Garzik <jgarzik@pobox.com>
10
11 [libata] locking rewrite (== fix)
12
13 A lot of power packed into a little patch.
14
15 This change eliminates the sharing between our controller-wide spinlock
16 and the SCSI core's Scsi_Host lock. As the locking in libata was
17 already highly compartmentalized, always referencing our own lock, and
18 never scsi_host::host_lock.
19
20 As a side effect, this change eliminates a deadlock from calling
21 scsi_finish_command() while inside our spinlock.
22
23
24 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
25
26 ---
27 drivers/scsi/libata-core.c | 2 --
28 drivers/scsi/libata-scsi.c | 9 ++++++++-
29 2 files changed, 8 insertions(+), 3 deletions(-)
30
31 --- linux-2.6.14.3.orig/drivers/scsi/libata-core.c
32 +++ linux-2.6.14.3/drivers/scsi/libata-core.c
33 @@ -3916,8 +3916,6 @@ static void ata_host_init(struct ata_por
34 host->unique_id = ata_unique_id++;
35 host->max_cmd_len = 12;
36
37 - scsi_assign_lock(host, &host_set->lock);
38 -
39 ap->flags = ATA_FLAG_PORT_DISABLED;
40 ap->id = host->unique_id;
41 ap->host = host;
42 --- linux-2.6.14.3.orig/drivers/scsi/libata-scsi.c
43 +++ linux-2.6.14.3/drivers/scsi/libata-scsi.c
44 @@ -39,6 +39,7 @@
45 #include <scsi/scsi.h>
46 #include "scsi.h"
47 #include <scsi/scsi_host.h>
48 +#include <scsi/scsi_device.h>
49 #include <linux/libata.h>
50 #include <asm/uaccess.h>
51
52 @@ -1565,8 +1566,12 @@ int ata_scsi_queuecmd(struct scsi_cmnd *
53 struct ata_port *ap;
54 struct ata_device *dev;
55 struct scsi_device *scsidev = cmd->device;
56 + struct Scsi_Host *shost = scsidev->host;
57
58 - ap = (struct ata_port *) &scsidev->host->hostdata[0];
59 + ap = (struct ata_port *) &shost->hostdata[0];
60 +
61 + spin_unlock(shost->host_lock);
62 + spin_lock(&ap->host_set->lock);
63
64 ata_scsi_dump_cdb(ap, cmd);
65
66 @@ -1589,6 +1594,8 @@ int ata_scsi_queuecmd(struct scsi_cmnd *
67 ata_scsi_translate(ap, dev, cmd, done, atapi_xlat);
68
69 out_unlock:
70 + spin_unlock(&ap->host_set->lock);
71 + spin_lock(shost->host_lock);
72 return 0;
73 }
74

  ViewVC Help
Powered by ViewVC 1.1.20