* [PATCH] libata: fix oops caused rescanning NULL sdev
@ 2006-06-12 13:51 Tejun Heo
2006-06-12 14:23 ` Jeff Garzik
0 siblings, 1 reply; 2+ messages in thread
From: Tejun Heo @ 2006-06-12 13:51 UTC (permalink / raw)
To: Jeff Garzik, Zhao, Forrest, linux-ide
Depending on timing, ata_scsi_dev_rescan() might encounter a device
which is enabled but not yet attached to sdev. On such cases, the
original code caused oops. This patch makes ata_scsi_dev_rescan()
rescan only device which are attached to sdevs.
While at it, properly indent leading comment and add description about
how it's synchronized with sdev attach/detach.
Signed-off-by: Tejun Heo <htejun@gmail.com>
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 45a49be..32c1df6 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -3005,14 +3005,16 @@ static int ata_scsi_user_scan(struct Scs
}
/**
- * ata_scsi_dev_rescan - initiate scsi_rescan_device()
- * @data: Pointer to ATA port to perform scsi_rescan_device()
+ * ata_scsi_dev_rescan - initiate scsi_rescan_device()
+ * @data: Pointer to ATA port to perform scsi_rescan_device()
*
- * After ATA pass thru (SAT) commands are executed successfully,
- * libata need to propagate the changes to SCSI layer.
+ * After ATA pass thru (SAT) commands are executed successfully,
+ * libata need to propagate the changes to SCSI layer. This
+ * function must be executed from ata_aux_wq such that sdev
+ * attach/detach don't race with rescan.
*
- * LOCKING:
- * Kernel thread context (may sleep).
+ * LOCKING:
+ * Kernel thread context (may sleep).
*/
void ata_scsi_dev_rescan(void *data)
{
@@ -3023,8 +3025,7 @@ void ata_scsi_dev_rescan(void *data)
for (i = 0; i < ATA_MAX_DEVICES; i++) {
dev = &ap->device[i];
- if (ata_dev_enabled(dev))
+ if (ata_dev_enabled(dev) && dev->sdev)
scsi_rescan_device(&(dev->sdev->sdev_gendev));
}
}
-
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] libata: fix oops caused rescanning NULL sdev
2006-06-12 13:51 [PATCH] libata: fix oops caused rescanning NULL sdev Tejun Heo
@ 2006-06-12 14:23 ` Jeff Garzik
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2006-06-12 14:23 UTC (permalink / raw)
To: Tejun Heo; +Cc: Zhao, Forrest, linux-ide
Tejun Heo wrote:
> Depending on timing, ata_scsi_dev_rescan() might encounter a device
> which is enabled but not yet attached to sdev. On such cases, the
> original code caused oops. This patch makes ata_scsi_dev_rescan()
> rescan only device which are attached to sdevs.
>
> While at it, properly indent leading comment and add description about
> how it's synchronized with sdev attach/detach.
>
> Signed-off-by: Tejun Heo <htejun@gmail.com>
applied
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-06-12 14:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-12 13:51 [PATCH] libata: fix oops caused rescanning NULL sdev Tejun Heo
2006-06-12 14:23 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).