From nobody Tue Jun 14 04:40:30 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AFB08838235; Tue, 14 Jun 2022 04:40:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LMbMy4cnpz4gnc; Tue, 14 Jun 2022 04:40:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655181630; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ue6z9+J4QtGpg3MUtswVpjtfVO3Qv0+B+NWemJmHcyQ=; b=me8SGS1lS2mRTrUE9NbNye+0MrKpsexVoUkMxZA5jdcXRUcF3Wt/tyyc3Ne+uJ8k9QgXdr o9h6uEx6vjxaGPJoHVhlYJaVp6lkhdEbACXygtgcLaOxdY6B+2qtw9x8/jYC7hyv5US1Ih WvAn5cVq1MLnKDQUZMohQqF1BwRxUhJFpeLqQemRAYfL+Fpw6WzZVdIf4calpBY8fLZmru IYRXBxuMkFIa94jAmWPfyIE739u3huXtHNF7Md03/WwO8bWB5ZrX+afniFmXNDzJA0QFc+ Mp/maQrmlSww/vUp5WTl14jEk3pzkNMgvQOKvs3q6h67eyx0HVFAhjXJdKfy/w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E85023B00; Tue, 14 Jun 2022 04:40:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25E4eU0G063151; Tue, 14 Jun 2022 04:40:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25E4eUba063150; Tue, 14 Jun 2022 04:40:30 GMT (envelope-from git) Date: Tue, 14 Jun 2022 04:40:30 GMT Message-Id: <202206140440.25E4eUba063150@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 3b0e3e8d2a6f - main - CTL: Fix double command completions on HA failover. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b0e3e8d2a6fab953a0ce537b6131330ccf36170 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655181630; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ue6z9+J4QtGpg3MUtswVpjtfVO3Qv0+B+NWemJmHcyQ=; b=Mb+Hw8li/EBNKpS5hhTPt0z/9oThb86BRtNOCN38ShGQJuhubI10amTRDleI9UBqrR+SnK euxyxoT+r6NuEeDRYe4S+9snq688GL22hgwAf09kaHijvaXkda7fVMDGQhteiHrRvIwAfZ N1ux4BO8dvi7fCluOLgasIWEEj+FYMjrZtiBBfajo5Oymns7lPxlsZOBbs1qcDDjMDV2+v O08HbdmzhYwVNuh+LfgtBICp9xThtthOoLMibZe7TkhiuQIHeAmqN/9dCFXPDz7u+TZmUS b52vuUmgnOfkBC9UqvlsgtDxV9TUM5+qWgeShQasVQyunbg8/9cZB4xZSC4Z+Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655181630; a=rsa-sha256; cv=none; b=io7/wDzsXvX37e4099ZYgoQl5QWGf+jW17EmQDlk0Z7GF1As3TuUYw7E/JKRXO7TdE1Bl2 s4ekAj2jrQDUgMxHdGXXLnDDT3ceTtAVwop/lMRAfH8Um28LBmxkAxFa8ROIxDFKJCBR/D 18KqSSIv7HyYSCK3phiXRX3/xb8moC8PLMQqzljMsiok3veTvlwzB1hpEatrwXd3NlqxDY SzBrrAPiGnGsYeTiZpKe9o6Md3KZKuPmLab3dzlwUqaSo5IzklCbb0iXObcM3Iz1WioTP9 ZCwP4Lic6zoLxXzTW+5URL6Z9MGHXIJmrdwL41UD0to9stRxWeJNeCEJ7t+a1w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=3b0e3e8d2a6fab953a0ce537b6131330ccf36170 commit 3b0e3e8d2a6fab953a0ce537b6131330ccf36170 Author: Alexander Motin AuthorDate: 2022-06-14 04:24:39 +0000 Commit: Alexander Motin CommitDate: 2022-06-14 04:24:39 +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. --- 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 6d06d4f5ad14..1fda5bde72c2 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;