Re: [ck] 2.6.11-ck6

From: Con Kolivas
Date: Sat Apr 30 2005 - 19:34:25 EST


On Sun, 1 May 2005 10:14, Con Kolivas wrote:
> On Sun, 1 May 2005 06:13, Jens Axboe wrote:
> > On Sun, May 01 2005, Con Kolivas wrote:
> > > +scsi-dead-device.diff
> > > A fix for a scsi related hang that seems to hit many -ck users
> >
> > This looks strange, like a fix and a half. You should just apply the
> > patch I sent you originally, weeks ago, changing sdev->sdev_lock to
> > &q->__queue_lock.
>
> rarrgh
>
> Thanks for keeping an eye out on for this. Unfortunately you sent more than
> one patch at different times and it looks like I included the wrong one
> then? This is the patch I (tried to) include.

I guess from your description this was the one I should have included... Looks
like a ck7 should come out instead since that other patch was more likely
harmful than not :\

Con
===== drivers/block/ll_rw_blk.c 1.288 vs edited =====
--- 1.288/drivers/block/ll_rw_blk.c 2005-03-31 12:47:54 +02:00
+++ edited/drivers/block/ll_rw_blk.c 2005-04-07 08:38:01 +02:00
@@ -1714,6 +1711,15 @@ request_queue_t *blk_init_queue(request_
if (blk_init_free_list(q))
goto out_init;

+ /*
+ * if caller didn't supply a lock, they get per-queue locking with
+ * our embedded lock
+ */
+ if (!lock) {
+ spin_lock_init(&q->__queue_lock);
+ lock = &q->__queue_lock;
+ }
+
q->request_fn = rfn;
q->back_merge_fn = ll_back_merge_fn;
q->front_merge_fn = ll_front_merge_fn;
===== drivers/scsi/scsi_lib.c 1.153 vs edited =====
--- 1.153/drivers/scsi/scsi_lib.c 2005-03-30 21:49:45 +02:00
+++ edited/drivers/scsi/scsi_lib.c 2005-04-07 08:42:30 +02:00
@@ -360,9 +360,9 @@ void scsi_device_unbusy(struct scsi_devi
shost->host_failed))
scsi_eh_wakeup(shost);
spin_unlock(shost->host_lock);
- spin_lock(&sdev->sdev_lock);
+ spin_lock(sdev->request_queue->queue_lock);
sdev->device_busy--;
- spin_unlock_irqrestore(&sdev->sdev_lock, flags);
+ spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
}

/*
@@ -1425,7 +1425,7 @@ struct request_queue *scsi_alloc_queue(s
struct Scsi_Host *shost = sdev->host;
struct request_queue *q;

- q = blk_init_queue(scsi_request_fn, &sdev->sdev_lock);
+ q = blk_init_queue(scsi_request_fn, NULL);
if (!q)
return NULL;

===== drivers/scsi/scsi_scan.c 1.143 vs edited =====
--- 1.143/drivers/scsi/scsi_scan.c 2005-03-23 22:58:13 +01:00
+++ edited/drivers/scsi/scsi_scan.c 2005-04-07 08:40:53 +02:00
@@ -249,7 +249,6 @@ static struct scsi_device *scsi_alloc_sd
*/
sdev->borken = 1;

- spin_lock_init(&sdev->sdev_lock);
sdev->request_queue = scsi_alloc_queue(sdev);
if (!sdev->request_queue) {
/* release fn is set up in scsi_sysfs_device_initialise, so
===== include/linux/blkdev.h 1.162 vs edited =====
--- 1.162/include/linux/blkdev.h 2005-03-29 03:42:37 +02:00
+++ edited/include/linux/blkdev.h 2005-04-07 08:36:06 +02:00
@@ -355,8 +364,11 @@ struct request_queue
unsigned long queue_flags;

/*
- * protects queue structures from reentrancy
+ * protects queue structures from reentrancy. ->__queue_lock should
+ * _never_ be used directly, it is queue private. always use
+ * ->queue_lock.
*/
+ spinlock_t __queue_lock;
spinlock_t *queue_lock;

/*
===== include/scsi/scsi_device.h 1.33 vs edited =====
--- 1.33/include/scsi/scsi_device.h 2005-03-23 22:58:05 +01:00
+++ edited/include/scsi/scsi_device.h 2005-04-07 08:41:09 +02:00
@@ -44,7 +44,6 @@ struct scsi_device {
struct list_head same_target_siblings; /* just the devices sharing same target id */

volatile unsigned short device_busy; /* commands actually active on low-level */
- spinlock_t sdev_lock; /* also the request queue_lock */
spinlock_t list_lock;
struct list_head cmd_list; /* queue of in use SCSI Command structures */
struct list_head starved_entry;



Attachment: pgp00000.pgp
Description: PGP signature