On 16.07.20 16:26, Kevin Wolf wrote: > Since commit a6b257a08e3 ('file-posix: Handle undetectable alignment'), > we assume that if we open a file with O_DIRECT and alignment probing > returns 1, we just couldn't find out the real alignment requirement > because some filesystems make the requirement only for allocated blocks. > In this case, a safe default of 4k is used. > > This is too strict for NFS, which does actually allow byte-aligned > requests even with O_DIRECT. Because we can't distinguish both cases > with generic code, let's just look at the file system magic and disable > s->needs_alignment for NFS. This way, O_DIRECT can still be used on NFS > for images that are not aligned to 4k. > > Signed-off-by: Kevin Wolf > Reviewed-by: Eric Blake > --- > block/file-posix.c | 26 +++++++++++++++++++++++++- > 1 file changed, 25 insertions(+), 1 deletion(-) Reviewed-by: Max Reitz