From nobody Sat Feb 08 21:43:10 2025 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 4Yr48H0Xfkz5nGBL; Sat, 08 Feb 2025 21:43:11 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yr48H00hRz3NPP; Sat, 08 Feb 2025 21:43:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1739050991; 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=Fds7v/OJYM8mqyYiQO1AH3QWpy0HQhgXLOCLz0dBUBg=; b=gpCIpBniOZ+hPbm4znElHUnbhjSzn3KQfFTHlqomQ6TGoxJfR4sc5fw71LLHGwUjxAMJvf AT59znvx+zaJdnE2PzAtKNGPuTSOT+IbW31CjLQgPyX2Yxiz6z5wV/kDavaj4xxE3MpjqO R5l7Nwp3CwA93nkMhLaUSE79b9B0T1LlVGMf8n+b+IWXxqeuxJ4cXavUIqk+PZDytJu3Ij z8GDm5w3cS8t2lms/WWrpiQRFLj0SYX90fQ9MgLBD2BSfdGoIC3RKv1hrSghe6hc7DNOUn /F91TqfeMDWLYo3b2pJkUwLK92EMlR9YhUuzHH+27N8Z70GO4UmVCuABRD5Sjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1739050991; 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=Fds7v/OJYM8mqyYiQO1AH3QWpy0HQhgXLOCLz0dBUBg=; b=o9FoA6oVB93Y88qZPbyruziCq8jI71v8ajAGfWpATQjFuUKU65Mh8yLIhh3PZP6KHoZa71 4gFIExE9Je/i0utuo2AcgRL8bVq5n7rOePqTH2gdkiA0hYsY9lmYzXqwWoEmcMv8We9ftQ ZsAQLqpoYzNmwL91noG9fK+l7NDtYwCqxdE714SI4PtkzzEXsGQNr1SCYKKRoRpkQBz0tG RZZDTtvDK58EOg/ZoMt+BiS8NOzADQ9/PDy5FW4R5S28mGavNxI5nwK0LJiRBwiUCkVl1/ P6wOB4QbQzlO+IwWxyVLPzNG5Baf68MqeY2hh2RjQV700ecSGZWXaWrUSLo0Lw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1739050991; a=rsa-sha256; cv=none; b=NfhYVO2/5Q46sSJA8GgLg7pFvSPidIG4n2tiPnv+j9SZHqcN64FcK5Yth/7rpHLuj20Ei9 gflO9Ubvye6oh31mqCOVZpbmp0D6DcCRN4b4iuCNhDVoSpHHhh9BxZhpBvGoZ4dyR2N9yh b/jPajgKx52c0xCeMXkn1aFAWKK+usVpLvlfLDxascXiLfrjyRFGey1AcPwBE7zhF5c2jq KPUCc1uXzS01nNHG6N64BIq7uaTEVHtlReDePOdaBe////LJEuenUHkHGBbejJQQ4jXxFg 4CyvfQXcyghCpu/aDewq1hV4/6KBXAu22DBrgD0MowMKJfLGZNFo+oPZlh746g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yr48G6RYLzCtX; Sat, 08 Feb 2025 21:43:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 518LhAq1097542; Sat, 8 Feb 2025 21:43:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 518LhASY097539; Sat, 8 Feb 2025 21:43:10 GMT (envelope-from git) Date: Sat, 8 Feb 2025 21:43:10 GMT Message-Id: <202502082143.518LhASY097539@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 82fc49a0bebf - main - cam/da: Only mark pack as valid if we know the size in daopen 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 82fc49a0bebf3f05e0584a1ed5cc6bbfd1cbd475 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=82fc49a0bebf3f05e0584a1ed5cc6bbfd1cbd475 commit 82fc49a0bebf3f05e0584a1ed5cc6bbfd1cbd475 Author: Warner Losh AuthorDate: 2025-02-08 21:31:07 +0000 Commit: Warner Losh CommitDate: 2025-02-08 21:31:07 +0000 cam/da: Only mark pack as valid if we know the size in daopen Only mark the pack as 'valid' (eg clear the invalid bit) when we know the size of the underlying drive and the periph hasn't been invalidated. Previously, we'd unconditionally clear this bit, but if the size isn't known, no I/O to the drive is possible. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D48688 --- sys/cam/scsi/scsi_da.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 1e685dc2a9e3..44dc21d1bc2f 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -1803,10 +1803,17 @@ daopen(struct disk *dp) (softc->quirks & DA_Q_NO_PREVENT) == 0) daprevent(periph, PR_PREVENT); - if (error == 0) { + /* + * Only 'validate' the pack if the media size is non-zero and the + * underlying peripheral isn't invalid (the only error != 0 path). + */ + if (error == 0 && softc->params.sectors != 0) softc->flags &= ~DA_FLAG_PACK_INVALID; + else + softc->flags |= DA_FLAG_PACK_INVALID; + + if (error == 0) softc->flags |= DA_FLAG_OPEN; - } da_periph_unhold(periph, DA_REF_OPEN_HOLD); cam_periph_unlock(periph);