On 28/07/2020 16.38, Goldwyn Rodrigues wrote:
On 19:08 22/07, Avi Kivity wrote:
On 13/12/2018 13.53, Goldwyn Rodrigues wrote:
For AIO+DIO with RWF_NOWAIT, if the block layer does not support REQ_NOWAIT,
it returns EIO. Return EOPNOTSUPP to represent the correct error code.
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx>
---
fs/direct-io.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 41a0e97252ae..77adf33916b8 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -542,10 +542,13 @@ static blk_status_t dio_bio_complete(struct dio *dio, struct bio *bio)
blk_status_t err = bio->bi_status;
if (err) {
- if (err == BLK_STS_AGAIN && (bio->bi_opf & REQ_NOWAIT))
- dio->io_error = -EAGAIN;
- else
- dio->io_error = -EIO;
+ dio->io_error = -EIO;
+ if (bio->bi_opf & REQ_NOWAIT) {
+ if (err == BLK_STS_AGAIN)
+ dio->io_error = -EAGAIN;
+ else if (err == BLK_STS_NOTSUPP)
+ dio->io_error = -EOPNOTSUPP;
+ }
}
if (dio->is_async && dio->op == REQ_OP_READ && dio->should_dirty) {
In the end, did this or some alternative get applied? I'd like to enable
RWF_NOWAIT support, but EIO scares me and my application.
No, it was not. There were lot of objections to return error from the
block layer for a filesystem nowait request.
I see. For me, it makes RWF_NOWAIT unusable, since I have no way to
distinguish between real EIO and EIO due to this bug.
Maybe the filesystem should ask the block device if it supports nowait
ahead of time (during mounting), and not pass REQ_NOWAIT at all in those
cases.