]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
IB/srp: Make writing into the "add_target" sysfs attribute interruptible
authorBart Van Assche <bvanassche@acm.org>
Fri, 14 Mar 2014 12:53:10 +0000 (13:53 +0100)
committerRoland Dreier <roland@purestorage.com>
Mon, 24 Mar 2014 17:05:31 +0000 (10:05 -0700)
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>
drivers/infiniband/ulp/srp/ib_srp.c

index 3294f10316a07f1325c8829838f5832f697f7340..481c873f735e7c15ac98ce233036b1cd2511b40a 100644 (file)
@@ -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);
@@ -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,
@@ -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