summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Marzinski <bmarzins@redhat.com>2024-09-17 19:06:43 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-11-08 16:25:53 +0100
commite1d57c29e4733dcc7d16284ac1b50a5a80aa7e4e (patch)
treea084532882b940ab469cbd1a988f2ad117dd291d
parent60fb94ef46c2359dd06cbe30bfc2499f639433df (diff)
downloadlinux-e1d57c29e4733dcc7d16284ac1b50a5a80aa7e4e.tar.gz
linux-e1d57c29e4733dcc7d16284ac1b50a5a80aa7e4e.tar.bz2
linux-e1d57c29e4733dcc7d16284ac1b50a5a80aa7e4e.zip
scsi: scsi_transport_fc: Allow setting rport state to current state
[ Upstream commit d539a871ae47a1f27a609a62e06093fa69d7ce99 ] The only input fc_rport_set_marginal_state() currently accepts is "Marginal" when port_state is "Online", and "Online" when the port_state is "Marginal". It should also allow setting port_state to its current state, either "Marginal or "Online". Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> Link: https://lore.kernel.org/r/20240917230643.966768-1-bmarzins@redhat.com Reviewed-by: Ewan D. Milne <emilne@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/scsi/scsi_transport_fc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index a2524106206d..fbe2036ca619 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -1250,7 +1250,7 @@ static ssize_t fc_rport_set_marginal_state(struct device *dev,
*/
if (rport->port_state == FC_PORTSTATE_ONLINE)
rport->port_state = port_state;
- else
+ else if (port_state != rport->port_state)
return -EINVAL;
} else if (port_state == FC_PORTSTATE_ONLINE) {
/*
@@ -1260,7 +1260,7 @@ static ssize_t fc_rport_set_marginal_state(struct device *dev,
*/
if (rport->port_state == FC_PORTSTATE_MARGINAL)
rport->port_state = port_state;
- else
+ else if (port_state != rport->port_state)
return -EINVAL;
} else
return -EINVAL;