aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_transport_fc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi_transport_fc.c')
-rw-r--r--drivers/scsi/scsi_transport_fc.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 062304de4854..5f77417ed585 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -2407,8 +2407,12 @@ fc_rport_final_delete(struct work_struct *work)
2407 /* 2407 /*
2408 * Notify the driver that the rport is now dead. The LLDD will 2408 * Notify the driver that the rport is now dead. The LLDD will
2409 * also guarantee that any communication to the rport is terminated 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 i->f->dev_loss_tmo_callbk(rport); 2416 i->f->dev_loss_tmo_callbk(rport);
2413 2417
2414 transport_remove_device(dev); 2418 transport_remove_device(dev);
@@ -2486,8 +2490,8 @@ fc_rport_create(struct Scsi_Host *shost, int channel,
2486 device_initialize(dev); /* takes self reference */ 2490 device_initialize(dev); /* takes self reference */
2487 dev->parent = get_device(&shost->shost_gendev); /* parent reference */ 2491 dev->parent = get_device(&shost->shost_gendev); /* parent reference */
2488 dev->release = fc_rport_dev_release; 2492 dev->release = fc_rport_dev_release;
2489 sprintf(dev->bus_id, "rport-%d:%d-%d", 2493 dev_set_name(dev, "rport-%d:%d-%d",
2490 shost->host_no, channel, rport->number); 2494 shost->host_no, channel, rport->number);
2491 transport_setup_device(dev); 2495 transport_setup_device(dev);
2492 2496
2493 error = device_add(dev); 2497 error = device_add(dev);
@@ -2647,7 +2651,8 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel,
2647 spin_lock_irqsave(shost->host_lock, flags); 2651 spin_lock_irqsave(shost->host_lock, flags);
2648 2652
2649 rport->flags &= ~(FC_RPORT_FAST_FAIL_TIMEDOUT | 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 /* if target, initiate a scan */ 2657 /* if target, initiate a scan */
2653 if (rport->scsi_target_id != -1) { 2658 if (rport->scsi_target_id != -1) {
@@ -2944,6 +2949,7 @@ fc_timeout_deleted_rport(struct work_struct *work)
2944 struct fc_rport *rport = 2949 struct fc_rport *rport =
2945 container_of(work, struct fc_rport, dev_loss_work.work); 2950 container_of(work, struct fc_rport, dev_loss_work.work);
2946 struct Scsi_Host *shost = rport_to_shost(rport); 2951 struct Scsi_Host *shost = rport_to_shost(rport);
2952 struct fc_internal *i = to_fc_internal(shost->transportt);
2947 struct fc_host_attrs *fc_host = shost_to_fc_host(shost); 2953 struct fc_host_attrs *fc_host = shost_to_fc_host(shost);
2948 unsigned long flags; 2954 unsigned long flags;
2949 2955
@@ -3011,6 +3017,7 @@ fc_timeout_deleted_rport(struct work_struct *work)
3011 rport->roles = FC_PORT_ROLE_UNKNOWN; 3017 rport->roles = FC_PORT_ROLE_UNKNOWN;
3012 rport->port_state = FC_PORTSTATE_NOTPRESENT; 3018 rport->port_state = FC_PORTSTATE_NOTPRESENT;
3013 rport->flags &= ~FC_RPORT_FAST_FAIL_TIMEDOUT; 3019 rport->flags &= ~FC_RPORT_FAST_FAIL_TIMEDOUT;
3020 rport->flags |= FC_RPORT_DEVLOSS_CALLBK_DONE;
3014 3021
3015 /* 3022 /*
3016 * Pre-emptively kill I/O rather than waiting for the work queue 3023 * Pre-emptively kill I/O rather than waiting for the work queue
@@ -3046,8 +3053,18 @@ fc_timeout_deleted_rport(struct work_struct *work)
3046 * all attached scsi devices. 3053 * all attached scsi devices.
3047 */ 3054 */
3048 fc_queue_work(shost, &rport->stgt_delete_work); 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}
3050 3066
3067
3051/** 3068/**
3052 * fc_timeout_fail_rport_io - Timeout handler for a fast io failing on a disconnected SCSI target. 3069 * fc_timeout_fail_rport_io - Timeout handler for a fast io failing on a disconnected SCSI target.
3053 * @work: rport to terminate io on. 3070 * @work: rport to terminate io on.
@@ -3164,8 +3181,8 @@ fc_vport_setup(struct Scsi_Host *shost, int channel, struct device *pdev,
3164 device_initialize(dev); /* takes self reference */ 3181 device_initialize(dev); /* takes self reference */
3165 dev->parent = get_device(pdev); /* takes parent reference */ 3182 dev->parent = get_device(pdev); /* takes parent reference */
3166 dev->release = fc_vport_dev_release; 3183 dev->release = fc_vport_dev_release;
3167 sprintf(dev->bus_id, "vport-%d:%d-%d", 3184 dev_set_name(dev, "vport-%d:%d-%d",
3168 shost->host_no, channel, vport->number); 3185 shost->host_no, channel, vport->number);
3169 transport_setup_device(dev); 3186 transport_setup_device(dev);
3170 3187
3171 error = device_add(dev); 3188 error = device_add(dev);
@@ -3188,19 +3205,19 @@ fc_vport_setup(struct Scsi_Host *shost, int channel, struct device *pdev,
3188 */ 3205 */
3189 if (pdev != &shost->shost_gendev) { 3206 if (pdev != &shost->shost_gendev) {
3190 error = sysfs_create_link(&shost->shost_gendev.kobj, 3207 error = sysfs_create_link(&shost->shost_gendev.kobj,
3191 &dev->kobj, dev->bus_id); 3208 &dev->kobj, dev_name(dev));
3192 if (error) 3209 if (error)
3193 printk(KERN_ERR 3210 printk(KERN_ERR
3194 "%s: Cannot create vport symlinks for " 3211 "%s: Cannot create vport symlinks for "
3195 "%s, err=%d\n", 3212 "%s, err=%d\n",
3196 __func__, dev->bus_id, error); 3213 __func__, dev_name(dev), error);
3197 } 3214 }
3198 spin_lock_irqsave(shost->host_lock, flags); 3215 spin_lock_irqsave(shost->host_lock, flags);
3199 vport->flags &= ~FC_VPORT_CREATING; 3216 vport->flags &= ~FC_VPORT_CREATING;
3200 spin_unlock_irqrestore(shost->host_lock, flags); 3217 spin_unlock_irqrestore(shost->host_lock, flags);
3201 3218
3202 dev_printk(KERN_NOTICE, pdev, 3219 dev_printk(KERN_NOTICE, pdev,
3203 "%s created via shost%d channel %d\n", dev->bus_id, 3220 "%s created via shost%d channel %d\n", dev_name(dev),
3204 shost->host_no, channel); 3221 shost->host_no, channel);
3205 3222
3206 *ret_vport = vport; 3223 *ret_vport = vport;
@@ -3297,7 +3314,7 @@ fc_vport_terminate(struct fc_vport *vport)
3297 return stat; 3314 return stat;
3298 3315
3299 if (dev->parent != &shost->shost_gendev) 3316 if (dev->parent != &shost->shost_gendev)
3300 sysfs_remove_link(&shost->shost_gendev.kobj, dev->bus_id); 3317 sysfs_remove_link(&shost->shost_gendev.kobj, dev_name(dev));
3301 transport_remove_device(dev); 3318 transport_remove_device(dev);
3302 device_del(dev); 3319 device_del(dev);
3303 transport_destroy_device(dev); 3320 transport_destroy_device(dev);
@@ -3329,7 +3346,7 @@ fc_vport_sched_delete(struct work_struct *work)
3329 dev_printk(KERN_ERR, vport->dev.parent, 3346 dev_printk(KERN_ERR, vport->dev.parent,
3330 "%s: %s could not be deleted created via " 3347 "%s: %s could not be deleted created via "
3331 "shost%d channel %d - error %d\n", __func__, 3348 "shost%d channel %d - error %d\n", __func__,
3332 vport->dev.bus_id, vport->shost->host_no, 3349 dev_name(&vport->dev), vport->shost->host_no,
3333 vport->channel, stat); 3350 vport->channel, stat);
3334} 3351}
3335 3352