git: 0e897d87f736 - stable/13 - CTL: Fix double command completions on HA failover.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 28 Jun 2022 18:14:56 UTC
The branch stable/13 has been updated by mav:
URL: https://cgit.FreeBSD.org/src/commit/?id=0e897d87f7367f6674dde7a6612a7124db0d2713
commit 0e897d87f7367f6674dde7a6612a7124db0d2713
Author: Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2022-06-14 04:24:39 +0000
Commit: Alexander Motin <mav@FreeBSD.org>
CommitDate: 2022-06-28 18:14:42 +0000
CTL: Fix double command completions on HA failover.
I've found couple cases when CTL_FLAG_SENT_2OTHER_SC flags were not
cleared on commands return from active node or the send failure. It
created races when ctl_failover_lun() call before ctl_process_done()
could cause second ctl_done() and ctl_process_done() calls, causing
all sorts of problems.
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
(cherry picked from commit 3b0e3e8d2a6fab953a0ce537b6131330ccf36170)
---
sys/cam/ctl/ctl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c
index 72f8597355ec..2083059c6aee 100644
--- a/sys/cam/ctl/ctl.c
+++ b/sys/cam/ctl/ctl.c
@@ -800,6 +800,7 @@ ctl_isc_handler_finish_xfer(struct ctl_softc *ctl_softc,
}
ctsio = &msg_info->hdr.original_sc->scsiio;
+ ctsio->io_hdr.flags &= ~CTL_FLAG_SENT_2OTHER_SC;
ctsio->io_hdr.flags |= CTL_FLAG_IO_ACTIVE;
ctsio->io_hdr.msg_type = CTL_MSG_FINISH_IO;
ctsio->io_hdr.status = msg_info->hdr.status;
@@ -11658,6 +11659,8 @@ ctl_scsiio_precheck(struct ctl_scsiio *ctsio)
if ((isc_retval = ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg_info,
sizeof(msg_info.scsi) - sizeof(msg_info.scsi.sense_data),
M_WAITOK)) > CTL_HA_STATUS_SUCCESS) {
+ ctsio->io_hdr.flags &= ~CTL_FLAG_SENT_2OTHER_SC;
+ ctsio->io_hdr.flags |= CTL_FLAG_IO_ACTIVE;
ctl_set_busy(ctsio);
ctl_done((union ctl_io *)ctsio);
return;