From nobody Tue Jul 02 13:22:36 2024 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 4WD3Vh4R3vz5QRCH; Tue, 02 Jul 2024 13:22:36 +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 4WD3Vh39gmz4yVJ; Tue, 2 Jul 2024 13:22:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719926556; 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=8N2CzVWlikaaA7cHzmUQYJywyqDaN3dZ8nVnP6uM1eU=; b=Tflrn1JSqpdgm3u0qvicqeW8J8cJOsn6lvICyIYFa3ph243Z8FemvJAoavxma+XnQmFCXs m+Na8yKGrAILYO+5rye0SpwTQ7ppTKi+8LtPs/eKoMW4chdCmFbJZr2VylAKACm3tN1bDE L4NG5nJMpj59u5taL8mgUI1ApbDdMFgPqtUsMU+6lnw+Hsq6G5Nb24UUeHKeI+5I96seIZ H0qR8rI2s6a+hx6IlZw5hcV4w5pRBem01PJwx6u5wQCayYOGdYFNbH9Y9+23wSeArKnsLP 3fNRmbD7ubTN0vp+bkYDixVwSWOoK+Fb8vRSO1p0I7y8XmNlFNvZ8Q4nrgBeKQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1719926556; a=rsa-sha256; cv=none; b=v2x68/WcDecpMZod1taQRdh7CeSsKV5v/iyanqF8DILX+EeYY4uJnQBtKDqrHOEykFHwKF /g3F4gv9DPmDoN3Efqk7mU5jZZ3qDFY6XNbYgFhhPnr6jH2yON6oQRRyd5HPRZNF3Qge/y I5KvQaZhBjvLgCKssHPsi+65YtbJ/naVaRv7IgVWpte1LKaDoGknpos5xdoIu3sWWtmNc2 k1da778BjoUwzB/HpTF6AxxrtTYQmwrdz9+xcPQvCosAA2RtYd93v+n69nwIV2pj14gnL+ bLgYKNI0AxWvGQ8YYdWhxYIvoni6wk93db/dtPJMhv+SsDMHlbYrzm+WsmY+nw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719926556; 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=8N2CzVWlikaaA7cHzmUQYJywyqDaN3dZ8nVnP6uM1eU=; b=qrIyFaC4LYI/XuxFbfAmfzvUQASJzFZhycGxWKyH+LnfWNxsHgoYQF5LSUgPrWJMj5khla BUyIgdrZ9lr0SsxpUwBoxFhie5woGdohIbGZEqwcjph0OKGveq8b6lNLe7BfkFLTt8scYn VUS5sWsBc+L9QqIdC3uzCShXINYsLTaYASVYrwaLD2TuR9+gnXLfZNub1GWM7dFUWKVBYm iB849Cqd8aHD+sSL7Gx21LDGsGl5686qvIZbXiB0+jqCL+0QxQdCRSfB5rP/jKrDCfQVyY 7uOvJDQyXZoCgB2957p4mJPaCUzMpBfIgWwlgVojEJZlzGG5+skDjWsRl+u56A== 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 4WD3Vh2nTvzq3q; Tue, 2 Jul 2024 13:22:36 +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 462DMaLE021239; Tue, 2 Jul 2024 13:22:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 462DMaQL021236; Tue, 2 Jul 2024 13:22:36 GMT (envelope-from git) Date: Tue, 2 Jul 2024 13:22:36 GMT Message-Id: <202407021322.462DMaQL021236@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 1a0314d6e305 - stable/14 - ctladm: Fix a race when loading ctl.ko 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1a0314d6e30554fc2b07caa5121b00956f416cc4 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1a0314d6e30554fc2b07caa5121b00956f416cc4 commit 1a0314d6e30554fc2b07caa5121b00956f416cc4 Author: Mark Johnston AuthorDate: 2024-06-24 15:09:18 +0000 Commit: Mark Johnston CommitDate: 2024-07-02 13:19:29 +0000 ctladm: Fix a race when loading ctl.ko If multiple ctladm processes try to load ctl.ko at the same time, only one will succeed. Handle this possibility by retrying the operation (open /dev/cam/ctl) if kldload returns EEXIST, rather than bailing. This at least helps ensure that ctladm tests can be run in parallel when ctl.ko is not preloaded. Reviewed by: asomers MFC after: 1 week (cherry picked from commit 7d6932d20aedbbb220cd78e90ab4e82d1abaad31) --- usr.sbin/ctladm/ctladm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/ctladm/ctladm.c b/usr.sbin/ctladm/ctladm.c index e99610373ff0..228af7bae8c6 100644 --- a/usr.sbin/ctladm/ctladm.c +++ b/usr.sbin/ctladm/ctladm.c @@ -4133,7 +4133,7 @@ main(int argc, char **argv) if (fd == -1 && errno == ENOENT) { saved_errno = errno; retval = kldload("ctl"); - if (retval != -1) + if (retval != -1 || errno == EEXIST) fd = open(device, O_RDWR); else errno = saved_errno;