diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2016-11-21 22:58:18 +0100 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-12-14 19:31:47 +0100 |
commit | 4fa354c9dbfef9226a690d8ee319b046f3067a6a (patch) | |
tree | c03b9e1df1752e7da6c988e5fa99b77e1cb3c5df /drivers/infiniband/ulp/srp | |
parent | IB/srp: Make mapping failures easier to debug (diff) | |
download | linux-4fa354c9dbfef9226a690d8ee319b046f3067a6a.tar.xz linux-4fa354c9dbfef9226a690d8ee319b046f3067a6a.zip |
IB/srp: Make writing the add_target sysfs attr interruptible
Avoid that shutdown of srp_daemon is delayed if add_target_mutex is
held by another process.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/ulp/srp')
-rw-r--r-- | drivers/infiniband/ulp/srp/ib_srp.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index bb9d73daadfa..8ddc07123193 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -3299,7 +3299,9 @@ static ssize_t srp_create_target(struct device *dev, */ scsi_host_get(target->scsi_host); - mutex_lock(&host->add_target_mutex); + ret = mutex_lock_interruptible(&host->add_target_mutex); + if (ret < 0) + goto put; ret = srp_parse_options(buf, target); if (ret) @@ -3455,6 +3457,7 @@ connected: out: mutex_unlock(&host->add_target_mutex); +put: scsi_host_put(target->scsi_host); if (ret < 0) scsi_host_put(target->scsi_host); |