From: Darrick J. Wong Date: Wed, 19 May 2021 23:57:16 +0000 (-0700) Subject: aio-dio-append-write-fallocate-race: fix directio buffer alignment bugs X-Git-Tag: v2022.05.01~393 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=74128e70c4b60b509b9eaaba6c051b8745415aaf;p=xfstests-dev.git aio-dio-append-write-fallocate-race: fix directio buffer alignment bugs This program fails on filesystems where the stat() block size isn't a strict power of two because it foolishly feeds that to posix_memalign to allocate an aligned memory buffer for directio. posix_memalign requires the alignment value to be a power of two, so generic/586 fails. The system page size generally works well for directio buffers, so use that instead. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Eryu Guan --- diff --git a/src/aio-dio-regress/aio-dio-append-write-fallocate-race.c b/src/aio-dio-regress/aio-dio-append-write-fallocate-race.c index 091b047d..d3a2e5fc 100644 --- a/src/aio-dio-regress/aio-dio-append-write-fallocate-race.c +++ b/src/aio-dio-regress/aio-dio-append-write-fallocate-race.c @@ -65,7 +65,7 @@ test( } blocksize = sbuf.st_blksize; - ret = posix_memalign((void **)&buf, blocksize, blocksize); + ret = posix_memalign((void **)&buf, sysconf(_SC_PAGESIZE), blocksize); if (ret) { errno = ret; perror("buffer");