Commit 4fa354c9 authored by Bart Van Assche's avatar Bart Van Assche Committed by Doug Ledford

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: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 290081b4
...@@ -3299,7 +3299,9 @@ static ssize_t srp_create_target(struct device *dev, ...@@ -3299,7 +3299,9 @@ static ssize_t srp_create_target(struct device *dev,
*/ */
scsi_host_get(target->scsi_host); 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); ret = srp_parse_options(buf, target);
if (ret) if (ret)
...@@ -3455,6 +3457,7 @@ static ssize_t srp_create_target(struct device *dev, ...@@ -3455,6 +3457,7 @@ static ssize_t srp_create_target(struct device *dev,
out: out:
mutex_unlock(&host->add_target_mutex); mutex_unlock(&host->add_target_mutex);
put:
scsi_host_put(target->scsi_host); scsi_host_put(target->scsi_host);
if (ret < 0) if (ret < 0)
scsi_host_put(target->scsi_host); scsi_host_put(target->scsi_host);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment