]> www.infradead.org Git - users/hch/xfstests-dev.git/commit
src/min_dio_alignment: don't return invalid dio_offset_align
authorChao Yu <chao@kernel.org>
Wed, 11 Sep 2024 03:53:33 +0000 (11:53 +0800)
committerZorro Lang <zlang@kernel.org>
Tue, 8 Oct 2024 03:20:59 +0000 (11:20 +0800)
commit4c9c08ec05c66766fbbc1e352d1dc62933fbc85c
tree3192265aa4b4ea16783acd8b55b4eb5e3a8924cc
parent790f4d8444fa4bed79d2b441212eec2167414c65
src/min_dio_alignment: don't return invalid dio_offset_align

If returned parameters of statx() are: a)STATX_DIOALIGN is set in
stx_mask, b)stx.stx_dio_offset_align is zero, it indicates filesystem
supports DIO, but the file doesn't.

It needs to avoid returning zeroed stx.stx_dio_offset_align value,
instead, we can fallthrough to get alignment size of block device or
page size, otherwise, it may cause potential deadloop, e.g.
generic/465:

align=stx_dio_offset_align(it equals to zero)
page_size=4096
while [ $align -le $page_size ]; do
    echo "$AIO_TEST -a $align -d $testfile.$align" >> $seqres.full
    $AIO_TEST -a $align -d $testfile.$align 2>&1 | tee -a $seqres.full
    align=$((align * 2))
done

Cc: Christoph Hellwig <hch@lst.de>
Cc: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
src/min_dio_alignment.c