qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [RFC PATCH v3 2/3] block: call the snapshot handlers of


From: MORITA Kazutaka
Subject: [Qemu-devel] Re: [RFC PATCH v3 2/3] block: call the snapshot handlers of the protocol drivers
Date: Mon, 17 May 2010 21:19:25 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.7 Emacs/22.2 (x86_64-pc-linux-gnu) MULE/5.0 (SAKAKI)

At Mon, 17 May 2010 13:08:08 +0200,
Kevin Wolf wrote:
> 
> Am 17.05.2010 12:19, schrieb MORITA Kazutaka:
> >  
> >  int bdrv_snapshot_goto(BlockDriverState *bs,
> >                         const char *snapshot_id)
> >  {
> >      BlockDriver *drv = bs->drv;
> > +    int ret, open_ret;
> > +
> >      if (!drv)
> >          return -ENOMEDIUM;
> > -    if (!drv->bdrv_snapshot_goto)
> > -        return -ENOTSUP;
> > -    return drv->bdrv_snapshot_goto(bs, snapshot_id);
> > +    if (drv->bdrv_snapshot_goto)
> > +        return drv->bdrv_snapshot_goto(bs, snapshot_id);
> > +
> > +    if (bs->file) {
> > +        drv->bdrv_close(bs);
> > +        ret = bdrv_snapshot_goto(bs->file, snapshot_id);
> > +        open_ret = drv->bdrv_open(bs, bs->open_flags);
> > +        if (open_ret < 0) {
> > +            bdrv_delete(bs);
> 
> I think you mean bs->file here.
> 
> Kevin

This is an error of re-opening the format driver, so what we should
delete here is not bs->file but bs, isn't it?  If we failed to open bs
here, the drive doesn't seem to work anymore.

Regards,

Kazutaka

> > +            bs->drv = NULL;
> > +            return open_ret;
> > +        }
> > +        return ret;
> > +    }
> > +
> > +    return -ENOTSUP;
> >  }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]