From nobody Thu Mar 30 23:36:51 2023 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 4Pnfvm1Nh7z42Wjb; Thu, 30 Mar 2023 23:36:52 +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 4Pnfvm0YNbz4GmN; Thu, 30 Mar 2023 23:36:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680219412; 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=o3jf3YUSLLdoZW2QKWvHYOXyFY3wD6Xkkzz6PqVcNbA=; b=Qib5oIZsJewihMPt2HpaQbgS+3dV2WtprISL4XSExEL/gWUzB4HyEVbWa5VyLAcAWc4HIh E9jXAydGQDqCuhs15u9cZTYmrWsypXNB9ZNp0OWTiOPatcCPEm0GXnGhLokaGK51mUseYH TDSwwFsJRX4t/1WAcdX4FHmlew40dR3iyuZl+WByjIcFz6nJ1reLt4ffd5gpcaDtpL/VfI 9C6ZWm4kjj32x1MooRNSS3p1zbRmS3nQ4kCRCK8fN/9vr7GYTv/IPdPzdemddLdfXZGT1N MoL3fXNTIjv4RswN7ulf6ymBxsWG3EmG9om5LJ6B0IuSgQGU9xhbED2ya8o4mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680219412; 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=o3jf3YUSLLdoZW2QKWvHYOXyFY3wD6Xkkzz6PqVcNbA=; b=Ub+DEL0BUIPMsTzVAdaq41hOT4/m7EKvbNNHksnNrYSfjeFzDu8/jrQHyfB3Sx5kwuXFsy uDKkQgWdEdyzOmjQOFmM0FqXhnrncLKsu9h2ZZSO+Lter1Va8dhk2HGhHGVJzG9u6jsurY kA4GJoDC4sy0xPpikpbFRjPRhCpEnvYy0GnlqrcZ7K0W2jZxegA4fEHf14Tqx3tl0WqZDV 40ffR/mkmVJTF1LA6sE/L3Hv/QOEM49ddi+dgY8zpedtqwvFT6+q7UkHQHARMmQOjiszUf FH3a9gPvdsYVwinjNKIatDyli22vSQhVIwCbQxqTY+HqxrIpfHQ4DZUdtD2O7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680219412; a=rsa-sha256; cv=none; b=dCX1/i3bWj+M/AK1Ff84s8ZngxPcis3lE8dOQNJa3gqi2DCk+W5GfQomSuyjkwA2tCL91f ju3RrnwhfeeKYCg2P5gjXi6WtJieUcxtnRYGoncg0VaUcMNgetTdbhY/lt7UDW7JdhdGEl SCs38hvSRr6Vbqz0pqvv82tfZyVZwUCwXa4HGRq2/Dl5QqgHU6qm1W0xZ0rcrUEDltvTRr vUCchUUzHX8wLTIOzP91yMW9IJIv/Ck1FJBsLbII5Bjq0//1tSSMLEOSBge5JQRWbJRwAT LaFWdijTkIL42xA8B3EWLF0eTv3fv3UFIKJULjnHEoIlZEZJJ6qJFCmJ3M6+pA== 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 4Pnfvl6QM9zWQt; Thu, 30 Mar 2023 23:36:51 +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 32UNapDG067538; Thu, 30 Mar 2023 23:36:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32UNapNp067537; Thu, 30 Mar 2023 23:36:51 GMT (envelope-from git) Date: Thu, 30 Mar 2023 23:36:51 GMT Message-Id: <202303302336.32UNapNp067537@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 9cefc0fb1387 - main - aio tests: Use unique names for zvols 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9cefc0fb1387f6c5b0954e875b14e596167c9a45 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9cefc0fb1387f6c5b0954e875b14e596167c9a45 commit 9cefc0fb1387f6c5b0954e875b14e596167c9a45 Author: Mark Johnston AuthorDate: 2023-03-25 19:41:07 +0000 Commit: Mark Johnston CommitDate: 2023-03-30 23:35:59 +0000 aio tests: Use unique names for zvols Otherwise tests which create zvols cannot be run in parallel. MFC after: 1 week --- tests/sys/aio/aio_test.c | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/tests/sys/aio/aio_test.c b/tests/sys/aio/aio_test.c index 5d244af7c5ac..eeb455882210 100644 --- a/tests/sys/aio/aio_test.c +++ b/tests/sys/aio/aio_test.c @@ -976,11 +976,12 @@ ATF_TC_CLEANUP(md_waitcomplete, tc) #define ZVOL_NAME "aio_testvol" static int -aio_zvol_setup(void) +aio_zvol_setup(const char *unique) { FILE *pidfile; int fd; pid_t pid; + char vdev_name[160]; char pool_name[80]; char cmd[160]; char zvol_name[160]; @@ -989,40 +990,44 @@ aio_zvol_setup(void) ATF_REQUIRE_KERNEL_MODULE("aio"); ATF_REQUIRE_KERNEL_MODULE("zfs"); - fd = open(ZVOL_VDEV_PATHNAME, O_RDWR | O_CREAT, 0600); + pid = getpid(); + snprintf(vdev_name, sizeof(vdev_name), "%s", ZVOL_VDEV_PATHNAME); + snprintf(pool_name, sizeof(pool_name), "%s_%s.%d", POOL_NAME, unique, + pid); + snprintf(zvol_name, sizeof(zvol_name), "%s/%s_%s", pool_name, ZVOL_NAME, + unique); + + fd = open(vdev_name, O_RDWR | O_CREAT, 0600); ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); ATF_REQUIRE_EQ_MSG(0, ftruncate(fd, POOL_SIZE), "ftruncate failed: %s", strerror(errno)); close(fd); - pid = getpid(); pidfile = fopen("pidfile", "w"); ATF_REQUIRE_MSG(NULL != pidfile, "fopen: %s", strerror(errno)); fprintf(pidfile, "%d", pid); fclose(pidfile); - snprintf(pool_name, sizeof(pool_name), POOL_NAME ".%d", pid); - snprintf(zvol_name, sizeof(zvol_name), "%s/" ZVOL_NAME, pool_name); - snprintf(cmd, sizeof(cmd), "zpool create %s $PWD/" ZVOL_VDEV_PATHNAME, - pool_name); + snprintf(cmd, sizeof(cmd), "zpool create %s $PWD/%s", pool_name, + vdev_name); ATF_REQUIRE_EQ_MSG(0, system(cmd), "zpool create failed: %s", strerror(errno)); snprintf(cmd, sizeof(cmd), - "zfs create -o volblocksize=8192 -o volmode=dev -V " - ZVOL_SIZE " %s", zvol_name); + "zfs create -o volblocksize=8192 -o volmode=dev -V %s %s", + ZVOL_SIZE, zvol_name); ATF_REQUIRE_EQ_MSG(0, system(cmd), "zfs create failed: %s", strerror(errno)); snprintf(devname, sizeof(devname), "/dev/zvol/%s", zvol_name); do { fd = open(devname, O_RDWR); - } while (fd == -1 && errno == EINTR) ; + } while (fd == -1 && errno == EINTR); ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); return (fd); } static void -aio_zvol_cleanup(void) +aio_zvol_cleanup(const char *unique) { FILE *pidfile; pid_t testpid; @@ -1037,7 +1042,8 @@ aio_zvol_cleanup(void) ATF_REQUIRE_EQ(1, fscanf(pidfile, "%d", &testpid)); fclose(pidfile); - snprintf(cmd, sizeof(cmd), "zpool destroy " POOL_NAME ".%d", testpid); + snprintf(cmd, sizeof(cmd), "zpool destroy %s_%s.%d", POOL_NAME, unique, + testpid); system(cmd); } @@ -1961,7 +1967,7 @@ ATF_TC_BODY(vectored_unaligned, tc) * Use a zvol with volmode=dev, so it will allow .d_write with * unaligned uio. geom devices use physio, which doesn't allow that. */ - fd = aio_zvol_setup(); + fd = aio_zvol_setup(atf_tc_get_ident(tc)); aio_context_init(&ac, fd, fd, FILE_LEN); /* Break the buffer into 3 parts: @@ -2010,16 +2016,17 @@ ATF_TC_BODY(vectored_unaligned, tc) } ATF_TC_CLEANUP(vectored_unaligned, tc) { - aio_zvol_cleanup(); + aio_zvol_cleanup(atf_tc_get_ident(tc)); } static void -aio_zvol_test(completion comp, struct sigevent *sev, bool vectored) +aio_zvol_test(completion comp, struct sigevent *sev, bool vectored, + const char *unique) { struct aio_context ac; int fd; - fd = aio_zvol_setup(); + fd = aio_zvol_setup(unique); aio_context_init(&ac, fd, fd, MD_LEN); if (vectored) { aio_writev_test(&ac, comp, sev); @@ -2045,11 +2052,11 @@ ATF_TC_BODY(vectored_zvol_poll, tc) { if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) atf_tc_skip("https://bugs.freebsd.org/258766"); - aio_zvol_test(poll, NULL, true); + aio_zvol_test(poll, NULL, true, atf_tc_get_ident(tc)); } ATF_TC_CLEANUP(vectored_zvol_poll, tc) { - aio_zvol_cleanup(); + aio_zvol_cleanup(atf_tc_get_ident(tc)); } ATF_TP_ADD_TCS(tp)