This patch also stops us from resetting the NS if
the fc_ns_gpn_id_req() call fails. We just schedule
the work now and that's it.
Q: What happens if there is an allocation failure within
a work thread? It doesn't return to any caller, so
how should we handle those types of failures?
Signed-off-by: Robert Love <[EMAIL PROTECTED]>
---
drivers/scsi/libfc/fc_ns.c | 37 ++++++++++++++++++-------------------
1 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/drivers/scsi/libfc/fc_ns.c b/drivers/scsi/libfc/fc_ns.c
index 2bdeafa..c58d131 100644
--- a/drivers/scsi/libfc/fc_ns.c
+++ b/drivers/scsi/libfc/fc_ns.c
@@ -44,7 +44,7 @@ static void fc_ns_disc_done(struct fc_lport *);
static void fcdt_ns_error(struct fc_lport *, struct fc_frame *);
static void fc_ns_timeout(struct work_struct *);
-static int fc_ns_gpn_id_req(struct fc_lport *, struct fc_ns_port *);
+static void fc_ns_gpn_id_req(struct work_struct *);
static void fc_ns_gpn_id_resp(struct fc_seq *, struct fc_frame *, void *);
static void fc_ns_gpn_id_error(struct fc_ns_port *rp, struct fc_frame *fp);
@@ -893,34 +893,36 @@ static void fc_ns_single(struct fc_lport *lp, struct
fc_ns_port *dp)
put_device(&rport->dev); /* hold from lookup */
}
- if (fc_ns_gpn_id_req(lp, dp) != 0)
- goto error;
+ INIT_WORK(&dp->rport_create_work, fc_ns_gpn_id_req);
+ schedule_work(&dp->rport_create_work);
return;
-error:
- fc_ns_restart(lp);
out:
kfree(dp);
}
/**
* fc_ns_gpn_id_req - Send Get Port Name by ID (GPN_ID) request
- * @lp: Fibre Channel host port instance
- * @dp: Temporary discovery port for holding IDs and world wide names
+ * @work: The work member of the fc_ns_port structure
*
+ * XXX - this the following statement still valid?
* The remote port is held by the caller for us.
*/
-static int fc_ns_gpn_id_req(struct fc_lport *lp, struct fc_ns_port *dp)
+static void fc_ns_gpn_id_req(struct work_struct *work)
{
+ struct fc_ns_port *dp = container_of(work,
+ struct fc_ns_port,
+ rport_create_work);
+
+ struct fc_lport *lp = dp->lp;
struct fc_frame *fp;
struct req {
struct fc_ct_hdr ct;
struct fc_ns_fid fid;
} *cp;
- int error = 0;
fp = fc_frame_alloc(lp, sizeof(*cp));
if (fp == NULL)
- return -ENOMEM;
+ return;
cp = fc_frame_payload_get(fp, sizeof(*cp));
fc_ns_fill_dns_hdr(lp, &cp->ct, FC_NS_GPN_ID, sizeof(cp->fid));
@@ -929,15 +931,12 @@ static int fc_ns_gpn_id_req(struct fc_lport *lp, struct
fc_ns_port *dp)
WARN_ON(!fc_lport_test_ready(lp));
fc_frame_setup(fp, FC_RCTL_DD_UNSOL_CTL, FC_TYPE_CT);
- if (!lp->tt.exch_seq_send(lp, fp,
- fc_ns_gpn_id_resp,
- dp, lp->e_d_tov,
- lp->fid,
- lp->dns_rp->port_id,
- FC_FC_SEQ_INIT | FC_FC_END_SEQ))
- error = -ENOMEM;
-
- return error;
+ lp->tt.exch_seq_send(lp, fp,
+ fc_ns_gpn_id_resp,
+ dp, lp->e_d_tov,
+ lp->fid,
+ lp->dns_rp->port_id,
+ FC_FC_SEQ_INIT | FC_FC_END_SEQ);
}
/**
_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel