Spurious EIO on AIO+DIO+RWF_NOWAIT
From: Avi Kivity
Date: Sun Dec 09 2018 - 06:19:58 EST
I have an application that receives spurious EIO when running with
RWF_NOWAIT enabled. Removing RWF_NOWAIT causes those EIOs to disappear.
The application uses AIO+DIO, and errors were seen on both xfs and ext4.
I suspect the following code:
/*
Â* Process one completed BIO. No locks are held.
Â*/
static blk_status_t dio_bio_complete(struct dio *dio, struct bio *bio)
{
ÂÂÂÂÂÂÂ struct bio_vec *bvec;
ÂÂÂÂÂÂÂ unsigned i;
ÂÂÂÂÂÂÂ 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;
ÂÂÂÂÂÂÂ }
Could it be that REQ_NOWAIT was dropped from bio->bi_opf? or that
bio->bi_status got changed along the way?
Reducing the test case may be a lot of work, but I can package a binary
using docker if a reproducer is needed. Seen on 4.18.19 and 4.19.something.