Commit 716b076b authored by Doug Ledford's avatar Doug Ledford

IB/srpt: Update sport->port_guid with each port refresh

If port_guid is set with the default subnet_prefix, then we get a change
event and run a port refresh, we don't update the port_guid.  As a
result, attempts to create a target device that uses the new
subnet_prefix in the wwn will fail to find a match and be rejected by
the ib_srpt driver.  This makes it impossible to configure a port if it
was initialized with a default subnet_prefix and later changed to any
non-default subnet-prefix.  Updating the port refresh task to always
update the wwn based upon the current subnext_prefix solves this
problem.

Cc: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: nab@linux-iscsi.org
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 3c199b45
...@@ -522,6 +522,11 @@ static int srpt_refresh_port(struct srpt_port *sport) ...@@ -522,6 +522,11 @@ static int srpt_refresh_port(struct srpt_port *sport)
if (ret) if (ret)
goto err_query_port; goto err_query_port;
snprintf(sport->port_guid, sizeof(sport->port_guid),
"0x%016llx%016llx",
be64_to_cpu(sport->gid.global.subnet_prefix),
be64_to_cpu(sport->gid.global.interface_id));
if (!sport->mad_agent) { if (!sport->mad_agent) {
memset(&reg_req, 0, sizeof(reg_req)); memset(&reg_req, 0, sizeof(reg_req));
reg_req.mgmt_class = IB_MGMT_CLASS_DEVICE_MGMT; reg_req.mgmt_class = IB_MGMT_CLASS_DEVICE_MGMT;
...@@ -2548,10 +2553,6 @@ static void srpt_add_one(struct ib_device *device) ...@@ -2548,10 +2553,6 @@ static void srpt_add_one(struct ib_device *device)
sdev->device->name, i); sdev->device->name, i);
goto err_ring; goto err_ring;
} }
snprintf(sport->port_guid, sizeof(sport->port_guid),
"0x%016llx%016llx",
be64_to_cpu(sport->gid.global.subnet_prefix),
be64_to_cpu(sport->gid.global.interface_id));
} }
spin_lock(&srpt_dev_lock); spin_lock(&srpt_dev_lock);
......
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