qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: ChangLimin <changlm@chinatelecom.cn>, qemu-block <qemu-block@nongnu.org>
Cc: kwolf <kwolf@redhat.com>, qemu-devel <qemu-devel@nongnu.org>,
	mreitz <mreitz@redhat.com>
Subject: Re: [PATCH V3] file-posix: allow -EBUSY -EINVAL errors during write zeros on block
Date: Wed, 17 Mar 2021 19:23:40 -0400	[thread overview]
Message-ID: <284d4c03-b7b1-cc77-c187-3dc468e83e0c@redhat.com> (raw)
In-Reply-To: <2021031008163294066310@chinatelecom.cn>

On 3/9/21 7:16 PM, ChangLimin wrote:
> Since Linux 5.10, write zeros to a multipath device using
> ioctl(fd, BLKZEROOUT, range) with cache none or directsync return -EBUSY
> permanently.
> 

When do we get -EINVAL? Both of the commits referenced below don't 
specifically mention it, so I am not sure in which circumstances that 
might arise.

> Similar to handle_aiocb_write_zeroes_unmap, handle_aiocb_write_zeroes_block
> allow -EBUSY and -EINVAL 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 
> <https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=384d87ef2c954fc58e6c5fd8253e4a1984f5fe02>
> 
> Although it will be fixed in 5.12, I think it's good to avoid similar 
> problem in the future.
> https://lore.kernel.org/linux-block/53689a67-7591-0ad8-3e7d-dca9a626cd99@kernel.dk/ 
> <https://lore.kernel.org/linux-block/53689a67-7591-0ad8-3e7d-dca9a626cd99@kernel.dk/>
> 

Wait, if they're fixing the function to actually apply a different 
fallback path, shouldn't we *not* allow EBUSY?

> Signed-off-by: ChangLimin <changlm@chinatelecom.cn>
> ---
>   block/file-posix.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/block/file-posix.c b/block/file-posix.c
> index 05079b40ca..4e132db929 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) {
> -            s->has_write_zeroes = false;
> +        switch (ret) {
> +        case -ENOTSUP:
> +            s->has_write_zeroes = false; /* fall through */
> +        case -EINVAL:
> +        case -EBUSY:
> +            return -ENOTSUP;
> +            break;

oh, we're not "allowing" them, we're treating the failure *more 
seriously* so that we avoid attempting to call this function ever again 
for this FD.

Can you please add a brief comment here, something like:

/* Linux 5.10/5.11 may return these for multipath devices */

>           }
>       }
>   #endif
> --
> 2.27.0
> 



  reply	other threads:[~2021-03-17 23:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10  0:16 [PATCH V3] file-posix: allow -EBUSY -EINVAL errors during write zeros on block ChangLimin
2021-03-17 23:23 ` John Snow [this message]
2021-03-18  8:19   ` Vladimir Sementsov-Ogievskiy via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=284d4c03-b7b1-cc77-c187-3dc468e83e0c@redhat.com \
    --to=jsnow@redhat.com \
    --cc=changlm@chinatelecom.cn \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).