From nobody Sun Dec 14 11:17:16 2025 Received: from mail-yw1-f228.google.com (mail-yw1-f228.google.com [209.85.128.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F52D2D8783 for ; Fri, 12 Dec 2025 17:17:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.228 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765559836; cv=none; b=rQ4fPtUvt6xJ+ePye46m151pL82CKvDTYmhVSPZO5y8SlhK/XPAc+3XAFmOyaXK7WGXcX7bva4/tk3VDBrhhd2+KfKqxmaH4ZGfZtlOFzJPMxHMWTSxeqq7R7+saQ9mYICppoFCM5EjAr+2gkasAQw1wgIyRzdwyjQEAlrXZCwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765559836; c=relaxed/simple; bh=llE0JIIYQL634M/3G9F8RQU6/HFxWG9VLOlfnehN3hE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PnF/ZtfQWTrsjixYcYqdUpgLXpP2Ty9yr0vKAo91McRODKmcaRN05VvRxCBTubvmaU1yVFexRWRKQv1aXzK8P1pBITX3QA06vRJFJqdHFK+zfiE1/uZFLzSFt00QnxR4InwSRrtQtVwr3+YMyjuZ/UCm693nRheejZByWyJVqfI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=M39/LGVY; arc=none smtp.client-ip=209.85.128.228 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="M39/LGVY" Received: by mail-yw1-f228.google.com with SMTP id 00721157ae682-78e6e16133dso175557b3.3 for ; Fri, 12 Dec 2025 09:17:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1765559831; x=1766164631; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=h/Z7l/OOLX/8k3+ZI1rZl85RyeDw72L7I7CsxK9Jg5s=; b=M39/LGVYJ49W0pdxmb3P/w7FgVpmVMgCqrnjChFNxSlnXy2eKKNkoHlf20yX9yhDE+ 00NPMUBAjscifX/rSfWzjuRf/zkHHefhOKw7w50AhSYifePOqfL+OYJ4J+jY+swZq0Bv idZ+ORze8iECWfs1RpZ1b+U+bUiNvAjlu0/9RL+wS0JMY3frj2m8ut6q1greuki0pBWY uJJk3RiA594C8m3n+u9grIHOuTeWlUhLY89Dhl/uyPpcqGG7yCSbNTSQ1HTvFyFDeZRz 05SY8O5KDn4AKubne/LyHk+ww4ITFObjTxotpgECUm3DxiAn9tOXswFanzPHFWOy6sjF Oyhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765559831; x=1766164631; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=h/Z7l/OOLX/8k3+ZI1rZl85RyeDw72L7I7CsxK9Jg5s=; b=VMPnOVnesl3F5gp05hl3fIuCO0SXHtt0BCaJbRREh2L17UYDgg05zP+h8DOE3CskEI V3Svj7UTMxCpA476pa7XWTiEKlKh3kTzjpAaPD5e5teCqG/QQ45jdGOFtb6dnVrzkvVp d7pNDwTljuuZ5R6mR/8RIwJeMoZc9KFj9CHn4Vb1/fH0aGK/8jILN+B/vzQjzJjkRuxK APh87S5rIRE+vwqVVyHgqyx0/AT9ThMUObzDZFzxkqaVEL2vCndUS9F52BGr3aZ1YFCv vND/UejIN3nEhIlpsizAlQRHyQ92OZxxtRA2YGbGe5NNr1KBB/ZaDJfx2j+XRdQXsdKd OCWw== X-Forwarded-Encrypted: i=1; AJvYcCVdM5hx1E+Jl4BmHVdgQ3qJOiwocJMeyF41qwkJ6BufYWHA8VQ/cxrQdGOqeEXp9T78yf2PvKxQxqKi0t8=@vger.kernel.org X-Gm-Message-State: AOJu0YzzPpyEzB/tduGTkDO/a1dapyQDOKumXHoygPJimwyjL0At/ptm BVFCfepB6MWLnw6nH6tIIYRJOzCjk7nsA2qI5cefQsadudeheaD67PID5JfAX64dmB0y5y5vIwu Nr9M8gMUt/v/u4LRyEHIman1BYu3EtU6zIs5Hv062Z8Uaw8c7b6ms X-Gm-Gg: AY/fxX50Cxh07lEqxLz2abzNA4CoTOX62yZmToljfC5eKdYEnMS+tyaMFF/oJPbO1kb 1M+0s9WG0EAK5Qjz4cYO4Wfn7D2GqAiDAG1DzO807AKi28eUUK7wiJL2S6pieWpJEzJ0MBNQYRJ NbarG6eApPUeRRk6AZguZXuV90SvaGaGG3gZ32C4+N5p5jBRz3idPtz3K5eaBtuwN1G1qhQIkCs mkC8PfFbCRub3gRww3JuiSzoiwTK58RYpJKZEL3woXqb4smkDrr4bfkpeuZJccfx03FirCJquhz 6NeLizS9HaOHLtfX7zCPaJiKPhppeUujd3rRdl84x557CiV6YBHRyp+vGR1wkwvWwKAjLpauTrp 0HPMcM3a7ZU17eFf3qa0yf0VfVA8= X-Google-Smtp-Source: AGHT+IHd+TXPCBhv1un/V2ZO13vV3k8hqTYx5RW3Ne144DrJv+wbC283WrsghZHKDveVuWX1ysPPuwCEM8xZ X-Received: by 2002:a05:690c:10:b0:78c:d4ce:4138 with SMTP id 00721157ae682-78e66e670dfmr21156037b3.8.1765559831034; Fri, 12 Dec 2025 09:17:11 -0800 (PST) Received: from c7-smtp-2023.dev.purestorage.com ([2620:125:9017:12:36:3:5:0]) by smtp-relay.gmail.com with ESMTPS id 00721157ae682-78e6a454ad8sm2171307b3.29.2025.12.12.09.17.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Dec 2025 09:17:11 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.7.70.37]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 2A9FF34027F; Fri, 12 Dec 2025 10:17:10 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 28B4FE4232B; Fri, 12 Dec 2025 10:17:10 -0700 (MST) From: Caleb Sander Mateos To: Ming Lei , Shuah Khan Cc: linux-block@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH v3 9/9] selftests: ublk: add user copy test cases Date: Fri, 12 Dec 2025 10:17:07 -0700 Message-ID: <20251212171707.1876250-10-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20251212171707.1876250-1-csander@purestorage.com> References: <20251212171707.1876250-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The ublk selftests cover every data copy mode except user copy. Add tests for user copy based on the existing test suite: - generic_14 ("basic recover function verification (user copy)") based on generic_04 and generic_05 - null_03 ("basic IO test with user copy") based on null_01 and null_02 - loop_06 ("write and verify over user copy") based on loop_01 and loop_03 - loop_07 ("mkfs & mount & umount with user copy") based on loop_02 and loop_04 - stripe_05 ("write and verify test on user copy") based on stripe_03 - stripe_06 ("mkfs & mount & umount on user copy") based on stripe_02 and stripe_04 - stress_06 ("run IO and remove device (user copy)") based on stress_01 and stress_03 - stress_07 ("run IO and kill ublk server (user copy)") based on stress_02 and stress_04 Signed-off-by: Caleb Sander Mateos Reviewed-by: Ming Lei --- tools/testing/selftests/ublk/Makefile | 8 ++++ .../testing/selftests/ublk/test_generic_14.sh | 40 +++++++++++++++++++ tools/testing/selftests/ublk/test_loop_06.sh | 25 ++++++++++++ tools/testing/selftests/ublk/test_loop_07.sh | 21 ++++++++++ tools/testing/selftests/ublk/test_null_03.sh | 24 +++++++++++ .../testing/selftests/ublk/test_stress_06.sh | 39 ++++++++++++++++++ .../testing/selftests/ublk/test_stress_07.sh | 39 ++++++++++++++++++ .../testing/selftests/ublk/test_stripe_05.sh | 26 ++++++++++++ .../testing/selftests/ublk/test_stripe_06.sh | 21 ++++++++++ 9 files changed, 243 insertions(+) create mode 100755 tools/testing/selftests/ublk/test_generic_14.sh create mode 100755 tools/testing/selftests/ublk/test_loop_06.sh create mode 100755 tools/testing/selftests/ublk/test_loop_07.sh create mode 100755 tools/testing/selftests/ublk/test_null_03.sh create mode 100755 tools/testing/selftests/ublk/test_stress_06.sh create mode 100755 tools/testing/selftests/ublk/test_stress_07.sh create mode 100755 tools/testing/selftests/ublk/test_stripe_05.sh create mode 100755 tools/testing/selftests/ublk/test_stripe_06.sh diff --git a/tools/testing/selftests/ublk/Makefile b/tools/testing/selftest= s/ublk/Makefile index 770269efe42a..837977b62417 100644 --- a/tools/testing/selftests/ublk/Makefile +++ b/tools/testing/selftests/ublk/Makefile @@ -19,28 +19,36 @@ TEST_PROGS +=3D test_generic_08.sh TEST_PROGS +=3D test_generic_09.sh TEST_PROGS +=3D test_generic_10.sh TEST_PROGS +=3D test_generic_11.sh TEST_PROGS +=3D test_generic_12.sh TEST_PROGS +=3D test_generic_13.sh +TEST_PROGS +=3D test_generic_14.sh =20 TEST_PROGS +=3D test_null_01.sh TEST_PROGS +=3D test_null_02.sh +TEST_PROGS +=3D test_null_03.sh TEST_PROGS +=3D test_loop_01.sh TEST_PROGS +=3D test_loop_02.sh TEST_PROGS +=3D test_loop_03.sh TEST_PROGS +=3D test_loop_04.sh TEST_PROGS +=3D test_loop_05.sh +TEST_PROGS +=3D test_loop_06.sh +TEST_PROGS +=3D test_loop_07.sh TEST_PROGS +=3D test_stripe_01.sh TEST_PROGS +=3D test_stripe_02.sh TEST_PROGS +=3D test_stripe_03.sh TEST_PROGS +=3D test_stripe_04.sh +TEST_PROGS +=3D test_stripe_05.sh +TEST_PROGS +=3D test_stripe_06.sh =20 TEST_PROGS +=3D test_stress_01.sh TEST_PROGS +=3D test_stress_02.sh TEST_PROGS +=3D test_stress_03.sh TEST_PROGS +=3D test_stress_04.sh TEST_PROGS +=3D test_stress_05.sh +TEST_PROGS +=3D test_stress_06.sh +TEST_PROGS +=3D test_stress_07.sh =20 TEST_GEN_PROGS_EXTENDED =3D kublk =20 include ../lib.mk =20 diff --git a/tools/testing/selftests/ublk/test_generic_14.sh b/tools/testin= g/selftests/ublk/test_generic_14.sh new file mode 100755 index 000000000000..cd9b44b97c24 --- /dev/null +++ b/tools/testing/selftests/ublk/test_generic_14.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh + +TID=3D"generic_14" +ERR_CODE=3D0 + +ublk_run_recover_test() +{ + run_io_and_recover 256M "kill_daemon" "$@" + ERR_CODE=3D$? + if [ ${ERR_CODE} -ne 0 ]; then + echo "$TID failure: $*" + _show_result $TID $ERR_CODE + fi +} + +if ! _have_program fio; then + exit "$UBLK_SKIP_CODE" +fi + +_prep_test "recover" "basic recover function verification (user copy)" + +_create_backfile 0 256M +_create_backfile 1 128M +_create_backfile 2 128M + +ublk_run_recover_test -t null -q 2 -r 1 -u & +ublk_run_recover_test -t loop -q 2 -r 1 -u "${UBLK_BACKFILES[0]}" & +ublk_run_recover_test -t stripe -q 2 -r 1 -u "${UBLK_BACKFILES[1]}" "${UBL= K_BACKFILES[2]}" & +wait + +ublk_run_recover_test -t null -q 2 -r 1 -u -i 1 & +ublk_run_recover_test -t loop -q 2 -r 1 -u -i 1 "${UBLK_BACKFILES[0]}" & +ublk_run_recover_test -t stripe -q 2 -r 1 -u -i 1 "${UBLK_BACKFILES[1]}" "= ${UBLK_BACKFILES[2]}" & +wait + +_cleanup_test "recover" +_show_result $TID $ERR_CODE diff --git a/tools/testing/selftests/ublk/test_loop_06.sh b/tools/testing/s= elftests/ublk/test_loop_06.sh new file mode 100755 index 000000000000..1d1a8a725502 --- /dev/null +++ b/tools/testing/selftests/ublk/test_loop_06.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh + +TID=3D"loop_06" +ERR_CODE=3D0 + +if ! _have_program fio; then + exit "$UBLK_SKIP_CODE" +fi + +_prep_test "loop" "write and verify over user copy" + +_create_backfile 0 256M +dev_id=3D$(_add_ublk_dev -t loop -u "${UBLK_BACKFILES[0]}") +_check_add_dev $TID $? + +# run fio over the ublk disk +_run_fio_verify_io --filename=3D/dev/ublkb"${dev_id}" --size=3D256M +ERR_CODE=3D$? + +_cleanup_test "loop" + +_show_result $TID $ERR_CODE diff --git a/tools/testing/selftests/ublk/test_loop_07.sh b/tools/testing/s= elftests/ublk/test_loop_07.sh new file mode 100755 index 000000000000..493f3fb611a5 --- /dev/null +++ b/tools/testing/selftests/ublk/test_loop_07.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh + +TID=3D"loop_07" +ERR_CODE=3D0 + +_prep_test "loop" "mkfs & mount & umount with user copy" + +_create_backfile 0 256M + +dev_id=3D$(_add_ublk_dev -t loop -u "${UBLK_BACKFILES[0]}") +_check_add_dev $TID $? + +_mkfs_mount_test /dev/ublkb"${dev_id}" +ERR_CODE=3D$? + +_cleanup_test "loop" + +_show_result $TID $ERR_CODE diff --git a/tools/testing/selftests/ublk/test_null_03.sh b/tools/testing/s= elftests/ublk/test_null_03.sh new file mode 100755 index 000000000000..0051067b4686 --- /dev/null +++ b/tools/testing/selftests/ublk/test_null_03.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh + +TID=3D"null_03" +ERR_CODE=3D0 + +if ! _have_program fio; then + exit "$UBLK_SKIP_CODE" +fi + +_prep_test "null" "basic IO test with user copy" + +dev_id=3D$(_add_ublk_dev -t null -u) +_check_add_dev $TID $? + +# run fio over the two disks +fio --name=3Djob1 --filename=3D/dev/ublkb"${dev_id}" --ioengine=3Dlibaio -= -rw=3Dreadwrite --iodepth=3D32 --size=3D256M > /dev/null 2>&1 +ERR_CODE=3D$? + +_cleanup_test "null" + +_show_result $TID $ERR_CODE diff --git a/tools/testing/selftests/ublk/test_stress_06.sh b/tools/testing= /selftests/ublk/test_stress_06.sh new file mode 100755 index 000000000000..37188ec2e1f7 --- /dev/null +++ b/tools/testing/selftests/ublk/test_stress_06.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh +TID=3D"stress_06" +ERR_CODE=3D0 + +ublk_io_and_remove() +{ + run_io_and_remove "$@" + ERR_CODE=3D$? + if [ ${ERR_CODE} -ne 0 ]; then + echo "$TID failure: $*" + _show_result $TID $ERR_CODE + fi +} + +if ! _have_program fio; then + exit "$UBLK_SKIP_CODE" +fi + +_prep_test "stress" "run IO and remove device (user copy)" + +_create_backfile 0 256M +_create_backfile 1 128M +_create_backfile 2 128M + +ublk_io_and_remove 8G -t null -q 4 -u & +ublk_io_and_remove 256M -t loop -q 4 -u "${UBLK_BACKFILES[0]}" & +ublk_io_and_remove 256M -t stripe -q 4 -u "${UBLK_BACKFILES[1]}" "${UBLK_B= ACKFILES[2]}" & +wait + +ublk_io_and_remove 8G -t null -q 4 -u --nthreads 8 --per_io_tasks & +ublk_io_and_remove 256M -t loop -q 4 -u --nthreads 8 --per_io_tasks "${UBL= K_BACKFILES[0]}" & +ublk_io_and_remove 256M -t stripe -q 4 -u --nthreads 8 --per_io_tasks "${U= BLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" & +wait + +_cleanup_test "stress" +_show_result $TID $ERR_CODE diff --git a/tools/testing/selftests/ublk/test_stress_07.sh b/tools/testing= /selftests/ublk/test_stress_07.sh new file mode 100755 index 000000000000..fb061fc26d36 --- /dev/null +++ b/tools/testing/selftests/ublk/test_stress_07.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh +TID=3D"stress_07" +ERR_CODE=3D0 + +ublk_io_and_kill_daemon() +{ + run_io_and_kill_daemon "$@" + ERR_CODE=3D$? + if [ ${ERR_CODE} -ne 0 ]; then + echo "$TID failure: $*" + _show_result $TID $ERR_CODE + fi +} + +if ! _have_program fio; then + exit "$UBLK_SKIP_CODE" +fi + +_prep_test "stress" "run IO and kill ublk server (user copy)" + +_create_backfile 0 256M +_create_backfile 1 128M +_create_backfile 2 128M + +ublk_io_and_kill_daemon 8G -t null -q 4 -u --no_ublk_fixed_fd & +ublk_io_and_kill_daemon 256M -t loop -q 4 -u --no_ublk_fixed_fd "${UBLK_BA= CKFILES[0]}" & +ublk_io_and_kill_daemon 256M -t stripe -q 4 -u "${UBLK_BACKFILES[1]}" "${U= BLK_BACKFILES[2]}" & +wait + +ublk_io_and_kill_daemon 8G -t null -q 4 -u --nthreads 8 --per_io_tasks & +ublk_io_and_kill_daemon 256M -t loop -q 4 -u --nthreads 8 --per_io_tasks "= ${UBLK_BACKFILES[0]}" & +ublk_io_and_kill_daemon 256M -t stripe -q 4 -u --nthreads 8 --per_io_tasks= "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" & +wait + +_cleanup_test "stress" +_show_result $TID $ERR_CODE diff --git a/tools/testing/selftests/ublk/test_stripe_05.sh b/tools/testing= /selftests/ublk/test_stripe_05.sh new file mode 100755 index 000000000000..05d71951d710 --- /dev/null +++ b/tools/testing/selftests/ublk/test_stripe_05.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh + +TID=3D"stripe_05" +ERR_CODE=3D0 + +if ! _have_program fio; then + exit "$UBLK_SKIP_CODE" +fi + +_prep_test "stripe" "write and verify test on user copy" + +_create_backfile 0 256M +_create_backfile 1 256M + +dev_id=3D$(_add_ublk_dev -t stripe -q 2 -u "${UBLK_BACKFILES[0]}" "${UBLK_= BACKFILES[1]}") +_check_add_dev $TID $? + +# run fio over the ublk disk +_run_fio_verify_io --filename=3D/dev/ublkb"${dev_id}" --size=3D512M +ERR_CODE=3D$? + +_cleanup_test "stripe" +_show_result $TID $ERR_CODE diff --git a/tools/testing/selftests/ublk/test_stripe_06.sh b/tools/testing= /selftests/ublk/test_stripe_06.sh new file mode 100755 index 000000000000..d06cac7626e2 --- /dev/null +++ b/tools/testing/selftests/ublk/test_stripe_06.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh + +TID=3D"stripe_06" +ERR_CODE=3D0 + +_prep_test "stripe" "mkfs & mount & umount on user copy" + +_create_backfile 0 256M +_create_backfile 1 256M + +dev_id=3D$(_add_ublk_dev -t stripe -u -q 2 "${UBLK_BACKFILES[0]}" "${UBLK_= BACKFILES[1]}") +_check_add_dev $TID $? + +_mkfs_mount_test /dev/ublkb"${dev_id}" +ERR_CODE=3D$? + +_cleanup_test "stripe" +_show_result $TID $ERR_CODE --=20 2.45.2