Am 02.03.2021 um 02:56 hat ChangLimin geschrieben: > After Linux 5.10, write zeros to a multipath device using > ioctl(fd, BLKZEROOUT, range) with cache none or directsync will return EBUSY. > > Similar to handle_aiocb_write_zeroes_unmap, handle_aiocb_write_zeroes_block > allow -EBUSY errors during ioctl(fd, BLKZEROOUT, range). > > Reference commit in Linux 5.10: > https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=384d87ef2c954fc58e6c5fd8253e4a1984f5fe02 > > Signed-off-by: ChangLimin <chan...@chinatelecom.cn> > --- > block/file-posix.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/block/file-posix.c b/block/file-posix.c > index 05079b40ca..3e60c96214 100644 > --- a/block/file-posix.c > +++ b/block/file-posix.c > @@ -1629,8 +1629,13 @@ static ssize_t > handle_aiocb_write_zeroes_block(RawPosixAIOData *aiocb) > } while (errno == EINTR); > > ret = translate_err(-errno); > - if (ret == -ENOTSUP) { > + switch (ret) { > + case -ENOTSUP: > + case -EINVAL: > + case -EBUSY: > s->has_write_zeroes = false;
Do we actually want -EINVAL and -EBUSY to completely stop us from trying again in future requests? -ENOTSUP will never change in future calls, but can't -EINVAL and -EBUSY? By the way, the commit message only explains -EBUSY. Why do we want to cover -EINVAL here, too? > + return -ENOTSUP; I suppose this is the important change: We convert the error codes to -ENOTSUP now so that block.c will emulate the operation instead of failing. This should be explained in the commit message. > + break; > } > } > #endif Kevin