[SCSI] ibmvstgt: move crq_queue_create to 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 to the end of initialization to avoid a race which
causes an oops if lost.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reported-by: Olaf Hering <olh@suse.de>
Cc: stable@kernel.org
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:
Brian King 2008-12-09 20:03:50 +09:00 коммит произвёл James Bottomley
Родитель d3acf0226d
Коммит 57458036af
1 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@ -864,21 +864,23 @@ 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);
if (err)
goto destroy_queue;
err = scsi_tgt_alloc_queue(shost);
if (err)
goto destroy_queue;
goto remove_host;
err = crq_queue_create(&vport->crq_queue, target);
if (err)
goto free_queue;
return 0;
destroy_queue:
crq_queue_destroy(target);
free_queue:
scsi_tgt_free_queue(shost);
remove_host:
scsi_remove_host(shost);
free_srp_target:
srp_target_free(target);
put_host: