[libvirt] [PATCH 09/12] storage: Cleanup failures in virStorageBackendCreateRaw

Peter Krempa pkrempa at redhat.com
Wed Oct 14 13:45:45 UTC 2015


On Wed, Oct 14, 2015 at 09:35:24 -0400, John Ferlan wrote:
> On 10/14/2015 08:16 AM, Peter Krempa wrote:
> > On Tue, Oct 13, 2015 at 16:12:46 -0400, John Ferlan wrote:

...

> > Erm, you've patched virFileOpenAs a few patches before this to do the
> > right thing when creating the file so I don't see a reason to make sure
> > again.
> > 
> 
> I know that, look closer at the code after the call to virFileOpenAs. We
> know that if virOpenFileAs succeeds then we've created the file (if it
> didn't exist prior to calling virOpenFileAs); however, if the following
> fails:
> 
> 
>     if ((ret = createRawFile(fd, vol, inputvol, reflink_copy)) < 0)
>         /* createRawFile already reported the exact error. */
>         ret = -1;
> 
> we would have left the function creating the file, but not deleting it
> because some subsequent action failed.

I agree that virStorageBackendCreateRaw needs to delete the file in some
cases. I just don't think that checking if the file exists prior to the
call to virOpenFileAs is necessary or makes sense in any way.

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20151014/d9743a63/attachment-0001.sig>


More information about the libvir-list mailing list