From: Kevin Wolf <kwolf@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: tony@bakeyournoodle.com, qemu-devel@nongnu.org,
Markus Armbruster <armbru@redhat.com>,
mreitz@redhat.com, stefanha@redhat.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/2] raw-posix: SEEK_HOLE suffices, get rid of FIEMAP
Date: Thu, 13 Nov 2014 12:40:30 +0100 [thread overview]
Message-ID: <20141113114030.GA3933@noname.redhat.com> (raw)
In-Reply-To: <5463EC70.1030107@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1235 bytes --]
Am 13.11.2014 um 00:25 hat Eric Blake geschrieben:
> On 11/12/2014 01:27 PM, Markus Armbruster wrote:
> > + /* in hole, end not yet known */
> > + offs = lseek(s->fd, start, SEEK_DATA);
> > + if (offs < 0) {
> > + /* no idea where the hole ends, give up (unlikely to happen) */
> > + goto dunno;
> > + }
> > + assert(offs >= start);
> > + *hole = start;
> > + *data = offs;
>
> This assertion feels like an off-by-one. The same offset cannot be both
> a hole and data (except in some racy situation where some other process
> is writing data to that offset in between our two lseek calls, but
> that's already in no-man's land because no one else should be writing
> the file while qemu has it open). Is it worth using 'assert(offs >
> start)' instead?
As soon as you say "except", it's wrong to assert this at all. We can't
guarantee that the condition is true and it's not a programming error
in qemu if it's false. Sounds to me as if it should be a normal error
check rather than an assertion.
Also, what happens after EOF? I haven't read the patch yet, maybe it
handles the situation already earlier, but if it doesn't, won't we get
offset == start then?
Kevin
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-11-13 11:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-12 19:27 [Qemu-devel] [PATCH 0/2] raw-posix: Get rid of FIEMAP Markus Armbruster
2014-11-12 19:27 ` [Qemu-devel] [PATCH 1/2] raw-posix: Fix comment for raw_co_get_block_status() Markus Armbruster
2014-11-12 23:18 ` Eric Blake
2014-11-13 1:46 ` Fam Zheng
2014-11-13 8:39 ` Max Reitz
2014-11-12 19:27 ` [Qemu-devel] [PATCH 2/2] raw-posix: SEEK_HOLE suffices, get rid of FIEMAP Markus Armbruster
2014-11-12 23:25 ` Eric Blake
2014-11-13 8:53 ` Markus Armbruster
2014-11-13 11:40 ` Kevin Wolf [this message]
2014-11-13 11:45 ` Max Reitz
2014-11-13 12:00 ` Kevin Wolf
2014-11-13 12:05 ` Max Reitz
2014-11-13 12:38 ` Markus Armbruster
2014-11-13 13:10 ` Kevin Wolf
2014-11-13 2:21 ` Fam Zheng
2014-11-13 8:26 ` Markus Armbruster
2014-11-13 8:39 ` Max Reitz
2014-11-13 9:25 ` Markus Armbruster
2014-11-12 22:14 ` [Qemu-devel] [PATCH 0/2] raw-posix: Get " Paolo Bonzini
2014-11-13 8:53 ` Markus Armbruster
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=20141113114030.GA3933@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=tony@bakeyournoodle.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).