From nobody Thu Apr 06 15:07:05 2023 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 4PslGL2csdz44SQW; Thu, 6 Apr 2023 15:07:06 +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 4PslGL0tJvz4M7J; Thu, 6 Apr 2023 15:07:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680793626; 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=c3X42z0Hr71T9gThmuyA4BXaaA8yT25x8mK0l2u8mkc=; b=rb+KKMf5N46UeMlANAuH+q1+7gc8Ww6plfvB0Exr12OZHN7zt6h7tGtMinH315y+8e3CKr DwUfKaD9mK+SbjoOxMqnO7kb+Z3gz59Onwr2qlDR7vSt/RAAwaZIwAQ1BwX4qSi5P4G8vp qHkUCctlMnO/UeM9Lean0cP7mWUTctFoSjLrz2vYAZjXoKLR5rRhhsAeg9YL4H42tagcUm lRzCCclsDQ2DGTsEUEhxpRseNEJh9pZhKc8PeIh6ipx5p4CX8YzLV6M/GH19a4LWmw9FVM LCkaLCmQFjDQwTuxFG3Qt0O/9gkkignFDsbqQq+38MUfLD4tdEqQDaRXNcB9eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680793626; 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=c3X42z0Hr71T9gThmuyA4BXaaA8yT25x8mK0l2u8mkc=; b=eN4Og6FNnDztLLwNwS17EmYNRXlR4BWnyX9etr7l3enMDBROuFH6qqMfcI/f/CK1rlgxM1 okRViWbhTiOxlAlf3rVZyO53s5bnnXiJ0PsIp7INESiQ2vSBwSpUVFvREYVJx5Wbbs9NiO HmVr8gJ/Cl+pZtDNehAoQtJh0GemSdWdMoIjhuJ7FoKputYc9BY1rNhcr6wVGep/XANGFq qoAcgLGL0XRgNCNMVLacws2zDchjQT65zrNjY/2RY44RMdaKc4GImqpwTshQXdulIqdAif Twm2TnIKrVX/eG9ZKyKADJHfiRRuwQBlTPKj4X+vFt7ScsOW6lL2tBheJFPItw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680793626; a=rsa-sha256; cv=none; b=ju6ChKF/Ewv1vLelTVkF40tIh82itcYGP54ehMMXFnyFPksdBANE4jxoKQSJ+HMNU7m61x JfQQihAWPqVwHa4Rhhe4IBvb0wbKGPVo6UOVm5VTQOR0I1Q4KIrOYcDTjF4j2YwPG535X8 jGm7VVWaBC52DesPL0RUjzLwZf7b9yWhlKf4mHCGHznpHDkejpqGMlEcXbt/SF3zbDiU06 Hg/mP18yx7ZYo7atyYSxu4xoV5UQOpYjH8+Wo9RkVkPS+q0ld2VpPcKsqyqJwQ0ekesaXI U5WH3Vvst0xA/IpBHl/6v36k8yigIXLXqQ/oc++4p5nQk/r7d2gZF1kxiEUegg== 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 4PslGK6zQrz186W; Thu, 6 Apr 2023 15:07:05 +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 336F75eN014842; Thu, 6 Apr 2023 15:07:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 336F75Qf014841; Thu, 6 Apr 2023 15:07:05 GMT (envelope-from git) Date: Thu, 6 Apr 2023 15:07:05 GMT Message-Id: <202304061507.336F75Qf014841@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: f6b47fe69528 - stable/13 - aio tests: Use unique names for zvols 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f6b47fe695289ca56cc17664e6911e0c0f8814f4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f6b47fe695289ca56cc17664e6911e0c0f8814f4 commit f6b47fe695289ca56cc17664e6911e0c0f8814f4 Author: Mark Johnston AuthorDate: 2023-03-25 19:41:07 +0000 Commit: Mark Johnston CommitDate: 2023-04-06 14:57:40 +0000 aio tests: Use unique names for zvols Otherwise tests which create zvols cannot be run in parallel. MFC after: 1 week (cherry picked from commit 9cefc0fb1387f6c5b0954e875b14e596167c9a45) --- 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 0c919da739e9..d7ee875f0991 100644 --- a/tests/sys/aio/aio_test.c +++ b/tests/sys/aio/aio_test.c @@ -974,11 +974,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]; @@ -987,40 +988,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; @@ -1035,7 +1040,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); } @@ -1814,7 +1820,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: @@ -1863,16 +1869,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); @@ -1898,11 +1905,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)