diff options
author | Bart Van Assche <bvanassche@acm.org> | 2013-08-17 16:34:43 -0400 |
---|---|---|
committer | Robert Love <robert.w.love@intel.com> | 2013-09-04 16:45:22 -0400 |
commit | 7030fd626129ec4d616784516a462d317c251d39 (patch) | |
tree | cd9a65fa2d45e6397ba1620846dc4c9359638df4 /include/scsi | |
parent | f95b35cfcacadac16dbc5477fd22b0786256a3d1 (diff) |
libfc: Do not invoke the response handler after fc_exch_done()
While the FCoE initiator driver invokes fc_exch_done() from inside
the libfc response handler, FCoE target drivers typically invoke
fc_exch_done() from outside the libfc response handler. The object
fc_exch.arg points at may disappear as soon as fc_exch_done() has
finished. So it's important not to invoke the response handler
function after fc_exch_done() has finished. Modify libfc such that
this guarantee is provided if fc_exch_done() is invoked from
outside a response handler. This patch fixes a sporadic crash in
FCoE target implementations after a command has been aborted.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/libfc.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index e1379b4e8faf..52beadf9a29b 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h | |||
@@ -410,6 +410,12 @@ struct fc_seq { | |||
410 | * @fh_type: The frame type | 410 | * @fh_type: The frame type |
411 | * @class: The class of service | 411 | * @class: The class of service |
412 | * @seq: The sequence in use on this exchange | 412 | * @seq: The sequence in use on this exchange |
413 | * @resp_active: Number of tasks that are concurrently executing @resp(). | ||
414 | * @resp_task: If @resp_active > 0, either the task executing @resp(), the | ||
415 | * task that has been interrupted to execute the soft-IRQ | ||
416 | * executing @resp() or NULL if more than one task is executing | ||
417 | * @resp concurrently. | ||
418 | * @resp_wq: Waitqueue for the tasks waiting on @resp_active. | ||
413 | * @resp: Callback for responses on this exchange | 419 | * @resp: Callback for responses on this exchange |
414 | * @destructor: Called when destroying the exchange | 420 | * @destructor: Called when destroying the exchange |
415 | * @arg: Passed as a void pointer to the resp() callback | 421 | * @arg: Passed as a void pointer to the resp() callback |
@@ -441,6 +447,9 @@ struct fc_exch { | |||
441 | u32 r_a_tov; | 447 | u32 r_a_tov; |
442 | u32 f_ctl; | 448 | u32 f_ctl; |
443 | struct fc_seq seq; | 449 | struct fc_seq seq; |
450 | int resp_active; | ||
451 | struct task_struct *resp_task; | ||
452 | wait_queue_head_t resp_wq; | ||
444 | void (*resp)(struct fc_seq *, struct fc_frame *, void *); | 453 | void (*resp)(struct fc_seq *, struct fc_frame *, void *); |
445 | void *arg; | 454 | void *arg; |
446 | void (*destructor)(struct fc_seq *, void *); | 455 | void (*destructor)(struct fc_seq *, void *); |