From 1d1b288c1a343c698837b7bb7d0acc153fa89af4 Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Mon, 30 Jun 2008 17:05:18 -0500 Subject: [PATCH 02/12] libfc: remove libfc scan_host We only want to call scsi_scan_host if we are hooked into the async scanning correctly, because the fc class does a scan from the rport workqueue. If we actually call scsi_scan_host from where scsi_scan is being called some bad things can happen because it will sleep while the scanning is being performed and we need to use those threads for the IO traffic. Signed-off-by: Mike Christie --- drivers/scsi/libfc/fc_disc.c | 7 +------ drivers/scsi/libfc/fc_scsi.c | 16 ++++------------ include/scsi/libfc/libfc.h | 5 ----- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c index 8d68da4..92c069c 100644 --- a/drivers/scsi/libfc/fc_disc.c +++ b/drivers/scsi/libfc/fc_disc.c @@ -544,11 +544,8 @@ static int fcdt_new_target(struct fc_lport *lp, rp->rp_disc_ver = lp->dns_disc_ver; if (rp->rp_disc_ver == 0 || rp->rp_sess_ready == 0) lp->tt.rport_login(rp->rport); - else { - if (!lp->dns_disc_done) - lp->tt.scan_host(lp); + else lp->dns_disc_done = 1; - } } } return error; @@ -606,8 +603,6 @@ static void fcdt_done(struct fc_lport *lp) } WARN_ON(held); fc_rp_list_unlock(lp); - if (!lp->dns_disc_done) - lp->tt.scan_host(lp); lp->dns_disc_done = 1; lp->fl_disc_in_prog = 0; if (lp->fl_disc_req) diff --git a/drivers/scsi/libfc/fc_scsi.c b/drivers/scsi/libfc/fc_scsi.c index 672ed50..220346d 100644 --- a/drivers/scsi/libfc/fc_scsi.c +++ b/drivers/scsi/libfc/fc_scsi.c @@ -2266,13 +2266,6 @@ void fc_put_dev(struct fc_lport *lp) } EXPORT_SYMBOL(fc_put_dev); -void fc_scan_host(struct fc_lport *lp) -{ - if (lp->state != LOCAL_PORT_ST_INIT) - scsi_scan_host(lp->host); -} -EXPORT_SYMBOL(fc_scan_host); - int fc_scsi_init(struct fc_lport *lp, struct fc_transport_template *tmpl) { @@ -2285,11 +2278,10 @@ int fc_scsi_init(struct fc_lport *lp, if (!lp->tt.scsi_abort_io) lp->tt.scsi_abort_io = fc_scsi_abort_io; - if (!lp->tt.scan_host) - lp->tt.scan_host = fc_scan_host; - - si = (struct fc_scsi_internal*)kzalloc(sizeof(struct fc_scsi_internal), GFP_ATOMIC); - lp->scsi_priv = (void*)si; + si = kzalloc(sizeof(struct fc_scsi_internal), GFP_KERNEL); + if (!si) + return -ENOMEM; + lp->scsi_priv = si; /* * create slab for pkt buffer diff --git a/include/scsi/libfc/libfc.h b/include/scsi/libfc/libfc.h index 4d81b00..5416300 100644 --- a/include/scsi/libfc/libfc.h +++ b/include/scsi/libfc/libfc.h @@ -425,11 +425,6 @@ struct fc_transport_template { */ void (*scsi_abort_io)(struct fc_lport *); - /* - * Tell the SCSI block to let the SCSI-ml scan the host. - */ - void (*scan_host)(struct fc_lport *); - /** * Discovery interfaces */ -- 1.5.4.1