Hi Benjamin, Changes looks good . Thanks for the fix. Regards, Muneendra. -----Original Message----- From: Benjamin Marzinski <bmarzins@xxxxxxxxxx> Sent: Tuesday, September 17, 2024 9:29 PM To: Christophe Varoqui <christophe.varoqui@xxxxxxxxxxx> Cc: device-mapper development <dm-devel@xxxxxxxxxxxxxxx>; Martin Wilck <Martin.Wilck@xxxxxxxx>; Muneendra Kumar <muneendra.kumar@xxxxxxxxxxxx> Subject: [PATCH] multipathd: checker port_state before setting it. 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_rem ote_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 <muneendra.kumar@xxxxxxxxxxxx> Signed-off-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx> --- multipathd/fpin_handlers.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/multipathd/fpin_handlers.c b/multipathd/fpin_handlers.c index be087ca0..6b56f9b7 100644 --- a/multipathd/fpin_handlers.c +++ b/multipathd/fpin_handlers.c @@ -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) -- 2.45.0 -- This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature