* [PATCH] src/min_dio_alignment: don't return invalid dio_offset_align
@ 2024-09-11 3:53 Chao Yu
2024-09-11 7:46 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2024-09-11 3:53 UTC (permalink / raw)
To: Zorro Lang; +Cc: fstests, Chao Yu, Christoph Hellwig, Eric Biggers
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>
---
src/min_dio_alignment.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/min_dio_alignment.c b/src/min_dio_alignment.c
index 131f6023..c1d7112d 100644
--- a/src/min_dio_alignment.c
+++ b/src/min_dio_alignment.c
@@ -28,7 +28,7 @@ static int min_dio_alignment(const char *mntpnt, const char *devname)
fd = open(mntpnt, O_TMPFILE | O_RDWR | O_EXCL, 0600);
if (fd >= 0 &&
xfstests_statx(fd, "", AT_EMPTY_PATH, STATX_DIOALIGN, &stx) == 0 &&
- (stx.stx_mask & STATX_DIOALIGN))
+ (stx.stx_mask & STATX_DIOALIGN) && stx.stx_dio_offset_align != 0)
return stx.stx_dio_offset_align;
/*
--
2.40.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] src/min_dio_alignment: don't return invalid dio_offset_align
2024-09-11 3:53 [PATCH] src/min_dio_alignment: don't return invalid dio_offset_align Chao Yu
@ 2024-09-11 7:46 ` Christoph Hellwig
2024-09-11 10:10 ` Chao Yu
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2024-09-11 7:46 UTC (permalink / raw)
To: Chao Yu; +Cc: Zorro Lang, fstests, Christoph Hellwig, Eric Biggers
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
although one day we might want to do something smarted with this
information. That being said a file system not supporting direct
I/O is a bit silly these days. What is running into this?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] src/min_dio_alignment: don't return invalid dio_offset_align
2024-09-11 7:46 ` Christoph Hellwig
@ 2024-09-11 10:10 ` Chao Yu
0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu @ 2024-09-11 10:10 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: chao, Zorro Lang, fstests, Eric Biggers
On 2024/9/11 15:46, Christoph Hellwig wrote:
> although one day we might want to do something smarted with this
> information. That being said a file system not supporting direct
> I/O is a bit silly these days. What is running into this?
After applying commit 5c8764f8679e ("f2fs: fix to force buffered IO
on inline_data inode"), inline_data enabled tmpfile shows it doesn't
support DIO, then it results in deadloop of generic/465.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-11 10:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-11 3:53 [PATCH] src/min_dio_alignment: don't return invalid dio_offset_align Chao Yu
2024-09-11 7:46 ` Christoph Hellwig
2024-09-11 10:10 ` Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox