forked from Minki/linux
io_uring: retry raw bdev writes if we hit -EOPNOTSUPP
For non-blocking issue, we set IOCB_NOWAIT in the kiocb. However, on a raw block device, this yields an -EOPNOTSUPP return, as non-blocking writes aren't supported. Turn this -EOPNOTSUPP into -EAGAIN, so we retry from blocking context with IOCB_NOWAIT cleared. Cc: stable@vger.kernel.org # 5.5 Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
8fef80bf56
commit
faac996ccd
@ -2340,6 +2340,12 @@ static int io_write(struct io_kiocb *req, struct io_kiocb **nxt,
|
||||
ret2 = call_write_iter(req->file, kiocb, &iter);
|
||||
else
|
||||
ret2 = loop_rw_iter(WRITE, req->file, kiocb, &iter);
|
||||
/*
|
||||
* Raw bdev writes will -EOPNOTSUPP for IOCB_NOWAIT. Just
|
||||
* retry them without IOCB_NOWAIT.
|
||||
*/
|
||||
if (ret2 == -EOPNOTSUPP && (kiocb->ki_flags & IOCB_NOWAIT))
|
||||
ret2 = -EAGAIN;
|
||||
if (!force_nonblock || ret2 != -EAGAIN) {
|
||||
kiocb_done(kiocb, ret2, nxt, req->in_async);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user