aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2014-03-14 08:53:40 -0400
committerRoland Dreier <roland@purestorage.com>2014-03-24 13:05:31 -0400
commitac72d766a8e44d782bd5480fc953ab6025c82e92 (patch)
tree509179496d89ed4ee5fac7389a871a237e47fe12
parenta702adceec3eeee23d95a81a0663661e7c25ad9c (diff)
IB/srp: Avoid that writing into "add_target" hangs due to a cable pull
If a cable is pulled while srp_connect_target() is in progress that can result in that function never to return. That makes the process, e.g. srp_daemon, that invoked this function unkillable. Avoid this by letting srp_connect_target() finish if the event IB_CM_TIMEWAIT_EXIT is received. This patch fixes a hang with the following call trace: [<ffffffff814eae85>] schedule_timeout+0x215/0x2e0 [<ffffffff814eab03>] wait_for_common+0x123/0x180 [<ffffffff814eac1d>] wait_for_completion+0x1d/0x20 [<ffffffffa03b398c>] srp_connect_target+0x1dc/0x410 [ib_srp] [<ffffffffa03b5809>] srp_create_target+0xba9/0xe70 [ib_srp] [<ffffffff8133e590>] dev_attr_store+0x20/0x30 [<ffffffff811eb8f5>] sysfs_write_file+0xe5/0x170 [<ffffffff811767c8>] vfs_write+0xb8/0x1a0 [<ffffffff811770c1>] sys_write+0x51/0x90 [<ffffffff8100b072>] system_call_fastpath+0x16/0x1b Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 481c873f735e..a64e469db116 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1871,6 +1871,7 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
1871 case IB_CM_TIMEWAIT_EXIT: 1871 case IB_CM_TIMEWAIT_EXIT:
1872 shost_printk(KERN_ERR, target->scsi_host, 1872 shost_printk(KERN_ERR, target->scsi_host,
1873 PFX "connection closed\n"); 1873 PFX "connection closed\n");
1874 comp = 1;
1874 1875
1875 target->status = 0; 1876 target->status = 0;
1876 break; 1877 break;