summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@wdc.com>2017-11-03 16:20:56 -0700
committerDoug Ledford <dledford@redhat.com>2017-11-13 15:25:16 -0500
commit57b0c46054999479272116ba3469006343856759 (patch)
tree382a39ede72f130458c6b634e4bb8e21aaae765a /drivers/infiniband/ulp
parent8b6dc529ea62bc021e0cdd5b0d4342ba470b5c92 (diff)
downloadlinux-57b0c46054999479272116ba3469006343856759.tar.bz2
IB/srpt: Ensure that modifying the use_srq configfs attribute works
The use_srq configfs attribute is created after it is read. Hence modify srpt_tpg_attrib_use_srq_store() such that this function switches dynamically between non-SRQ and SRQ mode. Reported-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index ca602eb50078..fde4f6741316 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -3054,7 +3054,9 @@ static ssize_t srpt_tpg_attrib_use_srq_store(struct config_item *item,
{
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct srpt_port *sport = srpt_tpg_to_sport(se_tpg);
+ struct srpt_device *sdev = sport->sdev;
unsigned long val;
+ bool enabled;
int ret;
ret = kstrtoul(page, 0, &val);
@@ -3062,7 +3064,17 @@ static ssize_t srpt_tpg_attrib_use_srq_store(struct config_item *item,
return ret;
if (val != !!val)
return -EINVAL;
+
+ ret = mutex_lock_interruptible(&sdev->mutex);
+ if (ret < 0)
+ return ret;
+ enabled = sport->enabled;
+ /* Log out all initiator systems before changing 'use_srq'. */
+ srpt_set_enabled(sport, false);
sport->port_attrib.use_srq = val;
+ srpt_use_srq(sdev, sport->port_attrib.use_srq);
+ srpt_set_enabled(sport, enabled);
+ mutex_unlock(&sdev->mutex);
return count;
}