From ff018bb77a371415a3973a58a70dfcc431862535 Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Fri, 4 Oct 2024 08:37:52 +0700 Subject: [PATCH] LU-18284 llite: disallow udio exceptions Require the unaligned_dio feature flag to be present and disable limited udio support for 2.14 and 2.15 as these exceptions cause failures with 2.12 servers. Test-Parameters: trivial Test-Parameters: testlist=sanity clientarch=x86_64 clientdistro=el9.4 serverversion=2.12.9 serverdistro=el7.9 env=ONLY="119e 119f 119g 119h 119i 119j",ONLY_REPEAT=10 Test-Parameters: testlist=sanity clientarch=x86_64 clientdistro=el9.2 serverversion=2.12.9 serverdistro=el7.9 env=ONLY="119e 119f 119g 119h 119i 119j",ONLY_REPEAT=10 Test-Parameters: testlist=sanity clientarch=x86_64 clientdistro=el8.10 serverversion=2.12.9 serverdistro=el7.9 env=ONLY="119e 119f 119g 119h 119i 119j",ONLY_REPEAT=10 Test-Parameters: testlist=sanity clientarch=x86_64 clientdistro=el8.10 serverversion=2.15.4 serverdistro=el8.9 env=ONLY="119e 119f 119g 119h 119i 119j",ONLY_REPEAT=10 Fixes: 07a1272233 ("LU-17525 llite: unaligned DIO interop page alignment") Signed-off-by: Shaun Tancheff Change-Id: If3d3d41f3f1f4f96279e9c3d7978f78dd7333259 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56571 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Timothy Day Reviewed-by: Oleg Drokin --- lustre/llite/rw26.c | 23 +++-------------------- lustre/tests/sanity.sh | 28 +++++++++++----------------- 2 files changed, 14 insertions(+), 37 deletions(-) diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index 4f83756..c3986e9 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -541,27 +541,10 @@ ll_direct_IO_impl(struct kiocb *iocb, struct iov_iter *iter, int rw) RETURN(0); /* Unpatched older servers which cannot safely support unaligned DIO - * (osd-zfs) or i/o with page size interop issues should abort here + * should abort here */ - if (unaligned && !cl_io_top(io)->ci_allow_unaligned_dio) { - unsigned int md0_offset; - - if (cl_io_top(io)->ci_target_is_zfs) - RETURN(-EINVAL); - - /* unpatched ldiskfs is fine, unless MD0 does not align/fit */ - md0_offset = file_offset & (MD_MAX_INTEROP_PAGE_SIZE - 1); - if ((count + md0_offset) >= LNET_MTU) { - u64 iomax, iomin; - - iomax = cl_io_nob_aligned(file_offset, count, - MD_MAX_INTEROP_PAGE_SIZE); - iomin = cl_io_nob_aligned(file_offset, count, - MD_MIN_INTEROP_PAGE_SIZE); - if (iomax != iomin) - RETURN(-EINVAL); - } - } + if (unaligned && !cl_io_top(io)->ci_allow_unaligned_dio) + RETURN(-EINVAL); /* if one part of an I/O is unaligned, just handle all of it that way - * otherwise we create significant complexities with managing the iovec diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 0ecbdf3..4fa0c46 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -14405,27 +14405,20 @@ unaligned_dio() { } # With unaligned_dio enabled there are no restrictions on dio. -unaligned_dio_or_ldiskfs_with_same_page_size() +unaligned_dio_or_skip() { - if [[ "${ost1_FSTYPE}" == "zfs" ]]; then - $LCTL get_param osc.*.import | grep connect_flags: | - grep -q "unaligned_dio" || - skip "Need ldiskfs server or 'unaligned_dio' support" - fi - if [[ $(get_page_size ost1) != $PAGE_SIZE ]]; then - $LCTL get_param osc.*.import | grep connect_flags: | - grep -q "unaligned_dio" || - skip "Need page interop support" + if ! unaligned_dio; then + skip "Need 'unaligned_dio' support" fi } dio_readv_writev_support() { # Kernels after 3.16 work: - (( $(version_code $(uname -r)) >= $(version_code 3.16) )) + (( $(version_code $(uname -r)) >= $(version_code 3.16) )) && return 0 # Lustre with LU-17524 works: - (( $OST1_VERSION > $(version_code 2.15.61.196) )) + (( $OST1_VERSION > $(version_code 2.15.61.196) )) && return 0 skip "need readv/writev with O_DIRECT support" @@ -14474,7 +14467,7 @@ run_test 119c "Testing for direct read hitting hole" test_119e() { - unaligned_dio_or_ldiskfs_with_same_page_size + unaligned_dio_or_skip (( $OSTCOUNT >= 2 )) || skip "needs >= 2 OSTs" local stripe_size=$((1024 * 1024)) #1 MiB @@ -14550,7 +14543,7 @@ run_test 119e "Basic tests of dio read and write at various sizes" test_119f() { - unaligned_dio_or_ldiskfs_with_same_page_size + unaligned_dio_or_skip (( $OSTCOUNT >= 2 )) || skip "needs >= 2 OSTs" local stripe_size=$((1024 * 1024)) #1 MiB @@ -14625,7 +14618,7 @@ run_test 119f "dio vs dio race" test_119g() { - unaligned_dio_or_ldiskfs_with_same_page_size + unaligned_dio_or_skip (( $OSTCOUNT >= 2 )) || skip "needs >= 2 OSTs" local stripe_size=$((1024 * 1024)) #1 MiB @@ -14695,7 +14688,7 @@ run_test 119g "dio vs buffered I/O race" test_119h() { - unaligned_dio_or_ldiskfs_with_same_page_size + unaligned_dio_or_skip (( $OSTCOUNT >= 2 )) || skip "needs >= 2 OSTs" local stripe_size=$((1024 * 1024)) #1 MiB @@ -14771,7 +14764,7 @@ run_test 119h "basic tests of memory unaligned dio" # aiocp with the '-a' option makes testing memory unaligned aio trivial test_119i() { - unaligned_dio_or_ldiskfs_with_same_page_size + unaligned_dio_or_skip (( $OSTCOUNT >= 2 )) || skip "needs >= 2 OSTs" which aiocp || skip_env "no aiocp installed" skip "LU-18032: Unaligned AIO is disabled and may not be re-enabled" @@ -14835,6 +14828,7 @@ run_test 119i "test unaligned aio at varying sizes" test_119j() { + unaligned_dio_or_skip (( $LINUX_VERSION_CODE > $(version_code 4.5.0) )) || skip "needs kernel > 4.5.0 for ki_flags support" -- 1.8.3.1