Skip to content

Commit

Permalink
multipathd: checker port_state before setting it.
Browse files Browse the repository at this point in the history
If the rport port_state is already Marginal, trying to set it to
Marginal causes an error like the following:

multipathd[365376]: /sys/devices/pci0000:c0/0000:c0:01.1/0000:c4:00.0/host0/rport-0:0-5/fc_remote_ports/rport-0:0-5: failed to set port_state to marginal: Invalid argument

To avoid causing this confusing error message, check if the port_state
is already marginal before trying to set it.

Cc: Muneendra Kumar <[email protected]>
Signed-off-by: Benjamin Marzinski <[email protected]>
Reviewed-by: Martin Wilck <[email protected]>
Acked-by: Muneendra Kumar M <[email protected]>
  • Loading branch information
bmarzins authored and mwilck committed Nov 6, 2024
1 parent 7cc87df commit e57cff3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions multipathd/fpin_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,14 @@ fpin_els_add_li_frame(struct fc_nl_event *fc_event)
/*Sets the rport port_state to marginal*/
static void fpin_set_rport_marginal(struct udev_device *rport_dev)
{
char old_value[20]; /* match kernel show_fc_rport_port_state() size */
static const char marginal[] = "Marginal";
ssize_t ret;

ret = sysfs_attr_get_value(rport_dev, "port_state",
old_value, sizeof(old_value));
if (ret == sizeof(marginal) - 1 && strcmp(old_value, marginal) == 0)
return;
ret = sysfs_attr_set_value(rport_dev, "port_state",
marginal, sizeof(marginal) - 1);
if (ret != sizeof(marginal) - 1)
Expand Down

0 comments on commit e57cff3

Please sign in to comment.