IB/srp: Don't send task management commands after target removal
authorRoland Dreier <rolandd@cisco.com>
Fri, 3 Mar 2006 23:47:25 +0000 (15:47 -0800)
committerRoland Dreier <rolandd@cisco.com>
Sat, 4 Mar 2006 01:50:16 +0000 (17:50 -0800)
Just fail abort and reset requests that come in after we've already
decided to remove a target.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/ulp/srp/ib_srp.c

index 2d2d4ac3525ab5af66bdc2805791ef18db493e05..960dae5c87d1d73d9b19fe24f094130df40ca1b4 100644 (file)
@@ -1155,6 +1155,12 @@ static int srp_send_tsk_mgmt(struct scsi_cmnd *scmnd, u8 func)
 
        spin_lock_irq(target->scsi_host->host_lock);
 
+       if (target->state == SRP_TARGET_DEAD ||
+           target->state == SRP_TARGET_REMOVED) {
+               scmnd->result = DID_BAD_TARGET << 16;
+               goto out;
+       }
+
        if (scmnd->host_scribble == (void *) -1L)
                goto out;