浏览代码

updates for CFQ oops fix

- add a comment to the device structure that the device_busy field
  is now protected by the request_queue->queue_lock
- null out sdev->request_queue after the queue is released to trap
  any (and there shouldn't be any) use after the queue is freed.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
20 年之前
父节点
当前提交
c2a9331c62
共有 2 个文件被更改,包括 4 次插入0 次删除
  1. 3 0
      drivers/scsi/scsi_sysfs.c
  2. 1 0
      include/scsi/scsi_device.h

+ 3 - 0
drivers/scsi/scsi_sysfs.c

@@ -171,6 +171,9 @@ void scsi_device_dev_release(struct device *dev)
 	if (sdev->request_queue) {
 	if (sdev->request_queue) {
 		sdev->request_queue->queuedata = NULL;
 		sdev->request_queue->queuedata = NULL;
 		scsi_free_queue(sdev->request_queue);
 		scsi_free_queue(sdev->request_queue);
+		/* temporary expedient, try to catch use of queue lock
+		 * after free of sdev */
+		sdev->request_queue = NULL;
 	}
 	}
 
 
 	scsi_target_reap(scsi_target(sdev));
 	scsi_target_reap(scsi_target(sdev));

+ 1 - 0
include/scsi/scsi_device.h

@@ -43,6 +43,7 @@ struct scsi_device {
 	struct list_head    siblings;   /* list of all devices on this host */
 	struct list_head    siblings;   /* list of all devices on this host */
 	struct list_head    same_target_siblings; /* just the devices sharing same target id */
 	struct list_head    same_target_siblings; /* just the devices sharing same target id */
 
 
+	/* this is now protected by the request_queue->queue_lock */
 	volatile unsigned short device_busy;	/* commands actually active on low-level */
 	volatile unsigned short device_busy;	/* commands actually active on low-level */
 	spinlock_t list_lock;
 	spinlock_t list_lock;
 	struct list_head cmd_list;	/* queue of in use SCSI Command structures */
 	struct list_head cmd_list;	/* queue of in use SCSI Command structures */