lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180907071530.te5dxdvg4zqgqscj@mac.bytemobile.com>
Date:   Fri, 7 Sep 2018 09:15:30 +0200
From:   Roger Pau Monné <roger.pau@...rix.com>
To:     Valentin Vidic <Valentin.Vidic@...Net.hr>
CC:     Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
        Jens Axboe <axboe@...nel.dk>, <xen-devel@...ts.xenproject.org>,
        <linux-block@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <stable@...r.kernel.org>, <drbd-user@...ts.linbit.com>
Subject: Re: [PATCH] xen-blkback: Switch to closed state after releasing the
 backing device

On Fri, Sep 07, 2018 at 12:19:29AM +0200, Valentin Vidic wrote:
> On Thu, Sep 06, 2018 at 06:29:32PM +0200, Roger Pau Monné wrote:
> > On Wed, Sep 05, 2018 at 06:28:01PM +0200, Valentin Vidic wrote:
> > > On Wed, Sep 05, 2018 at 01:35:15PM +0200, Valentin Vidic wrote:
> > > > > AFAICT, this will cause the backend to never switch to 'Closed' state
> > > > > until the toolstack sets online to 0, which is not good IMO.
> > > > > 
> > > > > If for example a frontend decides to close a device, the backend will
> > > > > stay in state 'Closing' until the toolstack actually removes the disk
> > > > > by setting online to 0.
> > > > > 
> > > > > This will prevent resetting blk connections, as blkback will refuse to
> > > > > switch to state XenbusStateInitWait unless it's at XenbusStateClosed
> > > > > (see the XenbusStateInitialising case in frontend_changed), which will
> > > > > never be reached with your patch.
> > > 
> > > Would it be possible to call xen_vbd_free before the state change?
> > > 
> > >         case XenbusStateClosed:
> > >                 xen_blkif_disconnect(be->blkif);
> > >                 xen_vbd_free(&be->blkif->vbd);
> > >                 xenbus_switch_state(dev, XenbusStateClosed);
> > 
> > I think that will break reconnection, since xen_vbd_create is only
> > called after hotplug script execution is performed (which happens only
> > once at device attachment), but not when DomU changes frontend
> > state.
> > 
> > If you want to perform this xen_vbd_free you will also have to move
> > the xen_vbd_create call AFAICT, to a place that's also called when
> > reconnecting a device. Note that I could be wrong, so it might be
> > worth a shot to try different approaches since the blkback code is
> > quite tangled and I might miss something.
> 
> It seems like the Closed state is not a good point to call the remove
> script since the device could go back from Closed to Connected.
> 
> Maybe it would help to introduce a new final state (7 = XenbusStateFree
> or XenbusStateRemove) that would be set after xen_vbd_free to let the
> userspace know it is safe to run the remove script?

I'm not sure that's a good idea, there are a lot of backends (apart
from blkback), and the tools won't know whether a specific backend
supports such state or not. Also the current protocol and states are
shared between all the Xen PV devices, so new additions should be
considered very carefully.

IMO the best options are either calling vbd_free/vbd_create at proper
stages in blkback or changing the hotplug script so it waits for the
device to have no open clients.

Thanks, Roger.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ