From a14b4fc04adc0cda2510c6d05515e6b7dc33f54e Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Fri, 12 Jul 2024 11:33:34 -0400 Subject: [PATCH] LU-18032 llite: disable unaligned AIO Parallel copy for unaligned DIO has an unpleasant interaction with AIO - Since AIO is async, we must do the copying first. This shows up as rare failures in 119i, which tests unaligned AIO. Handling this correctly for AIO introduces some complexity, so instead we disable unaligned AIO. This is a very small use case and the complexity is not worth the benefit. Signed-off-by: Patrick Farrell Change-Id: I81781da841b83130c9a7b5855abd88ae048f1908 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55716 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger Reviewed-by: Shaun Tancheff --- lustre/include/cl_object.h | 3 ++- lustre/llite/rw26.c | 4 ++++ lustre/obdclass/cl_io.c | 1 + lustre/tests/sanity.sh | 10 +++++++--- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lustre/include/cl_object.h b/lustre/include/cl_object.h index afe3dd8..85c4513 100644 --- a/lustre/include/cl_object.h +++ b/lustre/include/cl_object.h @@ -2541,7 +2541,8 @@ struct cl_dio_aio { ssize_t cda_bytes; struct mm_struct *cda_mm; unsigned cda_no_aio_complete:1, - cda_creator_free:1; + cda_creator_free:1, + cda_is_aio:1; }; struct cl_iter_dup { diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index 262cc5a..6b0d341 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -575,6 +575,10 @@ ll_direct_IO_impl(struct kiocb *iocb, struct iov_iter *iter, int rw) LASSERT(ll_dio_aio); LASSERT(ll_dio_aio->cda_iocb == iocb); + /* unaligned AIO is not supported - see LU-18032 */ + if (unaligned && ll_dio_aio->cda_is_aio) + RETURN(-EINVAL); + /* We cannot do parallel submission of sub-I/Os - for AIO or regular * DIO - unless lockless because it causes us to release the lock * early. diff --git a/lustre/obdclass/cl_io.c b/lustre/obdclass/cl_io.c index 1fb6d8c..4fa5f3f 100644 --- a/lustre/obdclass/cl_io.c +++ b/lustre/obdclass/cl_io.c @@ -1251,6 +1251,7 @@ struct cl_dio_aio *cl_dio_aio_alloc(struct kiocb *iocb, struct cl_object *obj, */ cl_sync_io_init_notify(&aio->cda_sync, 1, aio, cl_dio_aio_end); aio->cda_iocb = iocb; + aio->cda_is_aio = is_aio; aio->cda_no_aio_complete = !is_aio; /* if this is true AIO, the memory is freed by the last call * to cl_sync_io_note (when all the I/O is complete), because diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index d293085..05af821 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -42,6 +42,7 @@ always_except LU-6493 42b always_except LU-16515 118c 118d always_except LU-8411 407 always_except LU-17525 56x 56xa 56xb +always_except LU-18032 119i if $SHARED_KEY; then always_except LU-14181 64e 64f @@ -14719,6 +14720,8 @@ test_119h() } run_test 119h "basic tests of memory unaligned dio" +# Unaligned AIO is disabled and may not be reenabled +# See LU-18032 # aiocp with the '-a' option makes testing memory unaligned aio trivial test_119i() { @@ -28715,9 +28718,10 @@ test_398d() { # LU-13846 diff $DIR/$tfile $aio_file || error "file diff after aiocp" # test memory unaligned aio - aiocp -a 512 -b 64M -s 64M -f O_DIRECT $DIR/$tfile $aio_file || - error "unaligned aio failed" - diff $DIR/$tfile $aio_file || error "file diff after aiocp" + # LU-18032 - unaligned AIO is disabled + #aiocp -a 512 -b 64M -s 64M -f O_DIRECT $DIR/$tfile $aio_file || + # error "unaligned aio failed" + #diff $DIR/$tfile $aio_file || error "file diff after aiocp" rm -f $DIR/$tfile $aio_file } -- 1.8.3.1