All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org, Hanna Reitz <hreitz@redhat.com>,
	qemu-block@nongnu.org, Fam Zheng <fam@euphon.net>,
	eblake@redhat.com
Subject: Re: [PATCH v3 2/2] block/io: skip head/tail requests on EINVAL
Date: Thu, 17 Apr 2025 11:02:28 -0400	[thread overview]
Message-ID: <20250417150228.GC70767@fedora> (raw)
In-Reply-To: <aADAs7oerG789LTI@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1516 bytes --]

On Thu, Apr 17, 2025 at 10:49:55AM +0200, Kevin Wolf wrote:
> Am 14.04.2025 um 22:12 hat Stefan Hajnoczi geschrieben:
> > When guests send misaligned discard requests, the block layer breaks
> > them up into a misaligned head, an aligned main body, and a misaligned
> > tail.
> > 
> > The file-posix block driver on Linux returns -EINVAL on misaligned
> > discard requests. This causes bdrv_co_pdiscard() to fail and guests
> > configured with werror=stop will pause.
> > 
> > Add a special case for misaligned head/tail requests. Simply continue
> > when EINVAL is encountered so that the aligned main body of the request
> > can be completed and the guest is not paused. This is the best we can do
> > when guest discard limits do not match the host discard limits.
> > 
> > Fixes: https://issues.redhat.com/browse/RHEL-86032
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> > Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
> 
> It would be good to also update the comment a bit further up:
> 
>     /* Discard is advisory, but some devices track and coalesce
>      * unaligned requests, so we must pass everything down rather than
>      * round here.  Still, most devices will just silently ignore
>      * unaligned requests (by returning -ENOTSUP), so we must fragment
>      * the request accordingly.  */
> 
> I'm not sure where the -ENOTSUP came from (Eric, do you remember?), but
> we should at least mention this -EINVAL case separately.

Sounds good.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2025-04-17 15:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14 20:12 [PATCH v3 0/2] block: discard alignment fixes Stefan Hajnoczi
2025-04-14 20:12 ` [PATCH v3 1/2] file-posix: probe discard alignment on Linux block devices Stefan Hajnoczi
2025-04-17 16:27   ` Eric Blake
2025-04-17 16:31     ` Eric Blake
2025-04-14 20:12 ` [PATCH v3 2/2] block/io: skip head/tail requests on EINVAL Stefan Hajnoczi
2025-04-17  8:49   ` Kevin Wolf
2025-04-17 15:02     ` Stefan Hajnoczi [this message]
2025-04-17 15:32     ` Eric Blake

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=20250417150228.GC70767@fedora \
    --to=stefanha@redhat.com \
    --cc=eblake@redhat.com \
    --cc=fam@euphon.net \
    --cc=hreitz@redhat.com \
    --cc=kwolf@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.