On Wed, 3 Dec 2008 15:58:57 +0100 Olaf Hering <olh@xxxxxxx> wrote: > > change init order to fix crash due to uninitalized shost_data I think that calling crq_queue_create leads to the creation of a rport so we need to set up everything before that. The current code is racy. > No idea if the patch is correct. Almost correct, I think. Needs to modify the error handling too. Probably, it would be better to call scsi_tgt_alloc_queue before crq_queue_create. How about this? = From: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx> Subject: [PATCH] ibmvstgt: move crq_queue_create at the end of initialization Calling crq_queue_create could lead to the creation of a rport. We need to set up everything before creating a rport. This moves crq_queue_create at the end of initialization to avoid a race. Signed-off-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx> --- drivers/scsi/ibmvscsi/ibmvstgt.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c index 2a5b29d..8dcb59e 100644 --- a/drivers/scsi/ibmvscsi/ibmvstgt.c +++ b/drivers/scsi/ibmvscsi/ibmvstgt.c @@ -864,21 +864,19 @@ static int ibmvstgt_probe(struct vio_dev *dev, const struct vio_device_id *id) INIT_WORK(&vport->crq_work, handle_crq); - err = crq_queue_create(&vport->crq_queue, target); + err = scsi_add_host(shost, target->dev); if (err) goto free_srp_target; - err = scsi_add_host(shost, target->dev); + err = scsi_tgt_alloc_queue(shost); if (err) - goto destroy_queue; + goto free_srp_target; - err = scsi_tgt_alloc_queue(shost); + err = crq_queue_create(&vport->crq_queue, target); if (err) - goto destroy_queue; + goto free_srp_target; return 0; -destroy_queue: - crq_queue_destroy(target); free_srp_target: srp_target_free(target); put_host: -- 1.5.5.GIT -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html