[Lguest] [PATCH] lguest.c: truncate problems in handle_block_output
Chris Malley
mail at chrismalley.co.uk
Wed Sep 26 18:09:54 EST 2007
On Wed, 2007-09-26 at 09:53 +1000, Rusty Russell wrote:
> On Tue, 2007-09-25 at 17:13 +0100, Chris Malley wrote:
> > Hi
> >
> > I have been experiencing consistent problems with an lguest under moderate
> > I/O conditions (e.g. when updating the distribution with yum) where the guest
> > crashes with "Write past end 2965302784+4294967295", and I end up with a
> > zero-length disk image.
> >
> > Turns out this is because (a) the offset is *not* 4294967295, but the failure
> > code -1 (so in fact it isn't a "Write past end" at all, just a write failure).
> > And (b) because my block device is 4G and ftruncate() can't handle it, the
> > file is truncated to zero bytes.
>
> Hi Chris,
>
> Thanks for the patch! But I can't figure out why you are getting a
> write failure to trigger this. We open it with O_LARGEFILE: are you
> running out of disk space?
It's a possibility; that filesystem is getting pretty full up with guests :-)
That's why I put the errno reporting in there, to see if I could get a
decent error code. If I find out I'll post a followup.
> The ftruncate vs ftrucate64 bug is nasty. The block stuff is changing
> for 2.6.24, but of course I had the same bug there too...
>
> > len = readv(dev->fd, reply, reply_num);
> > - *lenp = len;
> > + if (len < 0) {
> > + err(1, "Read failed with error %u", errno);
> > + *lenp = 0;
> > + } else
> > + *lenp = len;
> > }
>
> BTW, we don't need the *lenp = 0 after the err() here.
Good point! (in an earlier version it didn't err() on failure).
> Thanks!
> Rusty.
>
No sweat; thanks for the great work, lguest is indeed fun to hack on as
promised :-)
--
Chris
More information about the Lguest
mailing list