From nobody Thu Apr 28 01:52:31 2022 X-Original-To: dev-commits-src-main@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 1E3DC1AA8520; Thu, 28 Apr 2022 01:52:32 +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 4Kpdsr0M9fz4vdn; Thu, 28 Apr 2022 01:52:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651110752; 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=3piRniS2uJ0Pv/K7py1E/boks8DEga7qi4/hAmi73JQ=; b=rHn3nEzpbDcaMcdS8P4rY2dep7F2ibDGdkDVidNBbR6N+i0kXpfPYM2JT2sDanJl0NJ5VZ u+zx5QOYAkXOz8yry6hUJ4kEFmjZjzVdUStZ2hamhT01L5e3KTCVNqvU8XQ1nf58Yb6d1u OkyZWpRRH/Dj9fYebx7kRmd5B7oiDTnuelCtDLRhx1st3a4Dpo+8/EGTDhdevc87oMs05X sshMn30vxU+aWGL7XLu1+BFvB37jdxITfT2C4d8Dr85rar8PqUTS4YMCk7jc8/DH3d+jHW hoY2udYx0Aw3nI8rQQMyyk23cWJoZRKK3dd1N1FH07xZ1tP03B4qAKVsvN+vJQ== 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 E0BAB7764; Thu, 28 Apr 2022 01:52:31 +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 23S1qVRD074453; Thu, 28 Apr 2022 01:52:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23S1qVqJ074452; Thu, 28 Apr 2022 01:52:31 GMT (envelope-from git) Date: Thu, 28 Apr 2022 01:52:31 GMT Message-Id: <202204280152.23S1qVqJ074452@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: 404f001161b9 - main - CAM: Keep periph_links when restoring CCB in camperiphdone(). List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 404f001161b975164d8b52d9f404d07ac7584027 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651110752; 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=3piRniS2uJ0Pv/K7py1E/boks8DEga7qi4/hAmi73JQ=; b=Gb6yrdI4iYTH2B2fq9cG7YuF6RIZ4n6rbNS+FXiQEXftxPukZL6AhtE0uVv1D8b1glD2JK IKQD1M8NOfyZrlnlnomcxjm2GxdqrYLWKMMI4pMxzVzYBZbGGm9wFkBbhMytHfqd0UpD0S /7iM7jWsaW6hPYLvgNVlRVR1xNzuhKxO+4aOp1XEucvx9dwEXoXpCvwEPi09KoatVCm5ps tmxa7g1ndePasCpe2+nUMNUKCl2tGfY02qKvxPoe4bUS3PPikmlZhAGPavhpD/htqIOHi3 05eJ4HriTnEtnMdq5noI8rWS+JYQo7e+OQFPvlSLl5BnbBBfwUK4ochfmXusbA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651110752; a=rsa-sha256; cv=none; b=G6aY7jrsQ3+rSyxJqODeHCpVccSM//sGTR6xd8pddVRiEYE4f+3KsKZ4kU8PZRV1Ak0MuM NzUOXOn3BpZ5DJ3/VUmxxr5804CZG5AtB3u1r3YxmkBaGEdUKgVA+JuWkiG98AcksI5Zc6 yYEuYgcZKVOAseDQilxZZupFd+hXMd98EfOK5vLLOmU3u2D2VqTpkwp9AI6uUM5e1b7qYj DE06ElZlC0VFVMZhhl4pi7PAM4z6Pksr0auF7lrw7RKxDSO9TT0/Mjd8S+fbdrsFN7BXmF kaNBKZDxqJxM3KtpgL+j41VERFsnU4cfw99qkFAccjQ6NBz/eBUmDxxogpihEg== 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=404f001161b975164d8b52d9f404d07ac7584027 commit 404f001161b975164d8b52d9f404d07ac7584027 Author: Alexander Motin AuthorDate: 2022-04-28 01:39:50 +0000 Commit: Alexander Motin CommitDate: 2022-04-28 01:39:50 +0000 CAM: Keep periph_links when restoring CCB in camperiphdone(). While recovery command executed, some other commands from the periph may complete, that may affect periph_links of this CCB. So restoring original CCB we must keep current periph_links as more up to date. I've found this triggering assertions with debug kernel and suspect some memory corruptions otherwise when spun down disk receives two or sometimes more concurrent requests. MFC after: 1 week Sponsored by: iXsystems, Inc. --- sys/cam/cam_periph.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 869691f59a72..7f8f0036f10b 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -1435,11 +1435,6 @@ camperiphdone(struct cam_periph *periph, union ccb *done_ccb) * blocking by that also any new recovery attempts for this CCB, * and the result will be the final one returned to the CCB owher. */ - - /* - * Copy the CCB back, preserving the alloc_flags field. Things - * will crash horribly if the CCBs are not of the same size. - */ saved_ccb = (union ccb *)done_ccb->ccb_h.saved_ccb_ptr; KASSERT(saved_ccb->ccb_h.func_code == XPT_SCSI_IO, ("%s: saved_ccb func_code %#x != XPT_SCSI_IO", @@ -1447,6 +1442,7 @@ camperiphdone(struct cam_periph *periph, union ccb *done_ccb) KASSERT(done_ccb->ccb_h.func_code == XPT_SCSI_IO, ("%s: done_ccb func_code %#x != XPT_SCSI_IO", __func__, done_ccb->ccb_h.func_code)); + saved_ccb->ccb_h.periph_links = done_ccb->ccb_h.periph_links; done_flags = done_ccb->ccb_h.alloc_flags; bcopy(saved_ccb, done_ccb, sizeof(struct ccb_scsiio)); done_ccb->ccb_h.alloc_flags = done_flags;