Commit 4be98c0ca304c8a47998b29a7993664f71791250

Authored by James Smart
Committed by James Bottomley
1 parent 58607b30fc

[SCSI] fc transport: restore missing dev_loss_tmo callback to LLDD

When we reworked the transport for the rport lifetimes, in cases where the
rport was reused as a container for tgt id bindings, we inadvertantly
removed the callback to the driver indicating that dev_loss_tmo had fired.

This patch restores that functionality.

Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

Showing 2 changed files with 20 additions and 2 deletions Side-by-side Diff

drivers/scsi/scsi_transport_fc.c
... ... @@ -2407,8 +2407,12 @@
2407 2407 /*
2408 2408 * Notify the driver that the rport is now dead. The LLDD will
2409 2409 * also guarantee that any communication to the rport is terminated
  2410 + *
  2411 + * Avoid this call if we already called it when we preserved the
  2412 + * rport for the binding.
2410 2413 */
2411   - if (i->f->dev_loss_tmo_callbk)
  2414 + if (!(rport->flags & FC_RPORT_DEVLOSS_CALLBK_DONE) &&
  2415 + (i->f->dev_loss_tmo_callbk))
2412 2416 i->f->dev_loss_tmo_callbk(rport);
2413 2417  
2414 2418 transport_remove_device(dev);
... ... @@ -2647,7 +2651,8 @@
2647 2651 spin_lock_irqsave(shost->host_lock, flags);
2648 2652  
2649 2653 rport->flags &= ~(FC_RPORT_FAST_FAIL_TIMEDOUT |
2650   - FC_RPORT_DEVLOSS_PENDING);
  2654 + FC_RPORT_DEVLOSS_PENDING |
  2655 + FC_RPORT_DEVLOSS_CALLBK_DONE);
2651 2656  
2652 2657 /* if target, initiate a scan */
2653 2658 if (rport->scsi_target_id != -1) {
... ... @@ -2944,6 +2949,7 @@
2944 2949 struct fc_rport *rport =
2945 2950 container_of(work, struct fc_rport, dev_loss_work.work);
2946 2951 struct Scsi_Host *shost = rport_to_shost(rport);
  2952 + struct fc_internal *i = to_fc_internal(shost->transportt);
2947 2953 struct fc_host_attrs *fc_host = shost_to_fc_host(shost);
2948 2954 unsigned long flags;
2949 2955  
... ... @@ -3011,6 +3017,7 @@
3011 3017 rport->roles = FC_PORT_ROLE_UNKNOWN;
3012 3018 rport->port_state = FC_PORTSTATE_NOTPRESENT;
3013 3019 rport->flags &= ~FC_RPORT_FAST_FAIL_TIMEDOUT;
  3020 + rport->flags |= FC_RPORT_DEVLOSS_CALLBK_DONE;
3014 3021  
3015 3022 /*
3016 3023 * Pre-emptively kill I/O rather than waiting for the work queue
3017 3024  
... ... @@ -3046,7 +3053,17 @@
3046 3053 * all attached scsi devices.
3047 3054 */
3048 3055 fc_queue_work(shost, &rport->stgt_delete_work);
  3056 +
  3057 + /*
  3058 + * Notify the driver that the rport is now dead. The LLDD will
  3059 + * also guarantee that any communication to the rport is terminated
  3060 + *
  3061 + * Note: we set the CALLBK_DONE flag above to correspond
  3062 + */
  3063 + if (i->f->dev_loss_tmo_callbk)
  3064 + i->f->dev_loss_tmo_callbk(rport);
3049 3065 }
  3066 +
3050 3067  
3051 3068 /**
3052 3069 * fc_timeout_fail_rport_io - Timeout handler for a fast io failing on a disconnected SCSI target.
include/scsi/scsi_transport_fc.h
... ... @@ -358,6 +358,7 @@
358 358 #define FC_RPORT_DEVLOSS_PENDING 0x01
359 359 #define FC_RPORT_SCAN_PENDING 0x02
360 360 #define FC_RPORT_FAST_FAIL_TIMEDOUT 0x04
  361 +#define FC_RPORT_DEVLOSS_CALLBK_DONE 0x08
361 362  
362 363 #define dev_to_rport(d) \
363 364 container_of(d, struct fc_rport, dev)