Skip to content

Commit

Permalink
IB/srp: Make writing into the "add_target" sysfs attribute interruptible
Browse files Browse the repository at this point in the history
Avoid that stopping srp_daemon takes unusually long due to a cable
pull by making writing into the "add_target" sysfs attribute
interruptible.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Roland Dreier <roland@purestorage.com>
  • Loading branch information
Bart Van Assche authored and Roland Dreier committed Mar 24, 2014
1 parent 2d7091b commit a702adc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/infiniband/ulp/srp/ib_srp.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ static void srp_path_rec_completion(int status,

static int srp_lookup_path(struct srp_target_port *target)
{
int ret;

target->path.numb_path = 1;

init_completion(&target->done);
Expand All @@ -431,7 +433,9 @@ static int srp_lookup_path(struct srp_target_port *target)
if (target->path_query_id < 0)
return target->path_query_id;

wait_for_completion(&target->done);
ret = wait_for_completion_interruptible(&target->done);
if (ret < 0)
return ret;

if (target->status < 0)
shost_printk(KERN_WARNING, target->scsi_host,
Expand Down Expand Up @@ -710,7 +714,9 @@ static int srp_connect_target(struct srp_target_port *target)
ret = srp_send_req(target);
if (ret)
return ret;
wait_for_completion(&target->done);
ret = wait_for_completion_interruptible(&target->done);
if (ret < 0)
return ret;

/*
* The CM event handling code will set status to
Expand Down

0 comments on commit a702adc

Please sign in to comment.