| Summary: | read() return -1 ENOMEM (Cannot allocate memory) when open() with O_DIRECT parameter | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Li Wang <liwan> |
| Component: | kernel-aarch64 | Assignee: | Dave Anderson <anderson> |
| kernel-aarch64 sub component: | Other | QA Contact: | Red Hat Kernel QE team <kernel-qe> |
| Status: | CLOSED CURRENTRELEASE | Docs Contact: | |
| Severity: | unspecified | ||
| Priority: | unspecified | CC: | eguan, lwoodman, shdeng |
| Version: | 7.2 | ||
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | aarch64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-02-11 20:38:35 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
|
Description
Li Wang
2016-01-29 09:22:23 UTC
This is most likely a side effect of the 64KB pages used in PPC64. Larry
This bug was recently introduced into the upstream kernel by this commit:
commit 74cedf9b6c603f2278a05bc91b140b32b434d0b5
Author: Jan Kara <jack>
Date: Mon Nov 30 10:15:42 2015 -0700
direct-io: Fix negative return from dio read beyond eof
Assume a filesystem with 4KB blocks. When a file has size 1000 bytes and
we issue direct IO read at offset 1024, blockdev_direct_IO() reads the
tail of the last block and the logic for handling short DIO reads in
dio_complete() results in a return value -24 (1000 - 1024) which
obviously confuses userspace.
Fix the problem by bailing out early once we sample i_size and can
reliably check that direct IO read starts beyond i_size.
Reported-by: Avi Kivity <avi>
Fixes: 9fe55eea7e4b444bafc42fa0000cc2d1d2847275
CC: stable.org
CC: Steven Whitehouse <swhiteho>
Signed-off-by: Jan Kara <jack>
Signed-off-by: Jens Axboe <axboe>
which was in 4.4-rc4:
# git describe --contains 74cedf9b6c603f2278a05bc91b140b32b434d0b5
v4.4-rc4~14^2~5
#
It was subsequently fixed by this commit:
commit 2d4594acbf6d8f75a27f3578476b6a27d8b13ebb
Author: Al Viro <viro.org.uk>
Date: Tue Dec 8 12:22:47 2015 -0500
fix the regression from "direct-io: Fix negative return from dio read beyond eof"
Sure, it's better to bail out of past-the-eof read and return 0 than return
a bogus negative value on such. Only we'd better make sure we are bailing out
with 0 and not -ENOMEM...
Cc: stable.org
Signed-off-by: Al Viro <viro.org.uk>
which was in 4.4-rc5:
git describe --contains 2d4594acbf6d8f75a27f3578476b6a27d8b13ebb
v4.4-rc5~24^2
The 4.4.0-0.rc4.21.el7 kernel-aarch64 snapshot just happened to
be taken in between the two commits above:
%define rpmversion 4.4.0
%define pkgrelease 0.rc4.21.el7
The current kernel-aarch64 kernel is version 4.5.0-0.rc3.27.el7, which
has Al Viro's fix, and which passes the test as expected:
# uname -r
4.5.0-0.rc3.27.el7.aarch64
# ./diotest4
PASS! Read beyond the file size
#
|