Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Jun 2022 18:15:25 GMT
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 5dc091a1b2a1 - stable/12 - CTL: Fix double command completions on HA failover.
Message-ID:  <202206281815.25SIFPBn068573@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=5dc091a1b2a1ba4eb3f5d54acd41f0fb326dc080

commit 5dc091a1b2a1ba4eb3f5d54acd41f0fb326dc080
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:15:19 +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 8439b837a01e..e909ccf70406 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;
@@ -11596,6 +11597,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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202206281815.25SIFPBn068573>