]> xenbits.xensource.com Git - libvirt.git/commit
storage: avoid short reads while chasing backing chain
authorEric Blake <eblake@redhat.com>
Tue, 5 Nov 2013 17:30:56 +0000 (10:30 -0700)
committerEric Blake <eblake@redhat.com>
Thu, 7 Nov 2013 00:14:02 +0000 (17:14 -0700)
commit5327fad4f292e4f3f84884ffe158c492bf00519c
tree44547475da1b8a6cff8b74a6ece5b62edde69acc
parent5717ee6ab871253c3e512ece7d59b754624e99c0
storage: avoid short reads while chasing backing chain

Our backing file chain code was not very robust to an ill-timed
EINTR, which could lead to a short read causing us to randomly
treat metadata differently than usual.  But the existing
virFileReadLimFD forces an error if we don't read the entire
file, even though we only care about the header of the file.
So add a new virFile function that does what we want.

* src/util/virfile.h (virFileReadHeaderFD): New prototype.
* src/util/virfile.c (virFileReadHeaderFD): New function.
* src/libvirt_private.syms (virfile.h): Export it.
* src/util/virstoragefile.c (virStorageFileGetMetadataInternal)
(virStorageFileProbeFormatFromFD): Use it.

Signed-off-by: Eric Blake <eblake@redhat.com>
src/libvirt_private.syms
src/util/virfile.c
src/util/virfile.h
src/util/virstoragefile.c