From: Kevin Wolf <kwolf@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org,
Max Reitz <mreitz@redhat.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>,
Viktor Mihajlovski <mihajlov@linux.ibm.com>
Subject: Re: [PATCH 1/2] block/file-posix: Fix problem with fallocate(PUNCH_HOLE) on GPFS
Date: Tue, 1 Jun 2021 13:35:10 +0200 [thread overview]
Message-ID: <YLYbbrhyAZBaKEIt@merkur.fritz.box> (raw)
In-Reply-To: <20210527172020.847617-2-thuth@redhat.com>
Am 27.05.2021 um 19:20 hat Thomas Huth geschrieben:
> A customer reported that running
>
> qemu-img convert -t none -O qcow2 -f qcow2 input.qcow2 output.qcow2
>
> fails for them with the following error message when the images are
> stored on a GPFS file system :
>
> qemu-img: error while writing sector 0: Invalid argument
>
> After analyzing the strace output, it seems like the problem is in
> handle_aiocb_write_zeroes(): The call to fallocate(FALLOC_FL_PUNCH_HOLE)
> returns EINVAL, which can apparently happen if the file system has
> a different idea of the granularity of the operation. It's arguably
> a bug in GPFS, since the PUNCH_HOLE mode should not result in EINVAL
> according to the man-page of fallocate(), but the file system is out
> there in production and so we have to deal with it. In commit 294682cc3a
> ("block: workaround for unaligned byte range in fallocate()") we also
> already applied the a work-around for the same problem to the earlier
> fallocate(FALLOC_FL_ZERO_RANGE) call, so do it now similar with the
> PUNCH_HOLE call. But instead of silently catching and returning
> -ENOTSUP (which causes the caller to fall back to writing zeroes),
> let's rather inform the user once about the buggy file system and
> try the other fallback instead.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> block/file-posix.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/block/file-posix.c b/block/file-posix.c
> index 10b71d9a13..134ff01d82 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -1650,6 +1650,16 @@ static int handle_aiocb_write_zeroes(void *opaque)
> return ret;
> }
> s->has_fallocate = false;
> + } else if (ret == -EINVAL) {
> + /*
> + * Some file systems like older versions of GPFS do not like un-
> + * aligned byte ranges, and return EINVAL in such a case, though
> + * they should not do it according to the man-page of fallocate().
> + * Warn about the bad filesystem and try the final fallback instead.
> + */
> + warn_report_once("Your file system is misbehaving: "
> + "fallocate(FALLOC_FL_PUNCH_HOLE) returned EINVAL. "
> + "Please report this bug to your file sytem vendor.");
This line is too long.
I've fixed it up and applied the series, thanks.
Kevin
next prev parent reply other threads:[~2021-06-01 11:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-27 17:20 [PATCH 0/2] Improve the fallocate() EINVAL in handle_aiocb_write_zeroes() Thomas Huth
2021-05-27 17:20 ` [PATCH 1/2] block/file-posix: Fix problem with fallocate(PUNCH_HOLE) on GPFS Thomas Huth
2021-06-01 11:35 ` Kevin Wolf [this message]
2021-05-27 17:20 ` [PATCH 2/2] block/file-posix: Try other fallbacks after invalid FALLOC_FL_ZERO_RANGE Thomas Huth
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=YLYbbrhyAZBaKEIt@merkur.fritz.box \
--to=kwolf@redhat.com \
--cc=andrey.shinkevich@virtuozzo.com \
--cc=borntraeger@de.ibm.com \
--cc=mihajlov@linux.ibm.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/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).