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

Re: [Xen-users] Xen shutdown fails to release DRBD device



On Wed, Aug 22, 2018 at 05:39:28PM +0200, Valentin Vidic wrote:
> On Wed, Aug 22, 2018 at 03:55:46PM +0200, Valentin Vidic wrote:
> > DRBD end for this seems rather simple, it only checks if the
> > device->open_cnt is zero. So it would seem like drbd_release
> > was not called yet when the block-drbd script is run?
> > 
> > 
> > static enum drbd_state_rv
> > is_valid_state(struct drbd_device *device, union drbd_state ns)
> > {
> > ...
> >         else if (ns.role == R_SECONDARY && device->open_cnt)
> >                 rv = SS_DEVICE_IN_USE;
> > ...
> > }
> > 
> > static void drbd_release(struct gendisk *gd, fmode_t mode)
> > {
> >         struct drbd_device *device = gd->private_data;
> >         mutex_lock(&drbd_main_mutex);
> >         device->open_cnt--;
> >         mutex_unlock(&drbd_main_mutex);
> > }
> 
> On the Xen side it seems that XenbusStateClosed event is sent
> to xenbus to run the block-drbd script.  However the call to
> xen_blkif_disconnect in the line before that can fail with -EBUSY
> if there is still some in-flight IO for the device.  Could it be
> that a lot of IO during shutdown is holding the DRBD device open
> while the block-drbd script has already started running?
> 
> /*
>  * Callback received when the frontend's state changes.
>  */
> static void frontend_changed(struct xenbus_device *dev,
>                              enum xenbus_state frontend_state)
> {
> ...
>         case XenbusStateClosed:
>                 xen_blkif_disconnect(be->blkif);
>                 xenbus_switch_state(dev, XenbusStateClosed);
>                 if (xenbus_dev_is_online(dev))
>                         break;
>                 /* fall through if not online */
> ...
> }
> 
> Maybe the XenbusStateClosed event should only be send when the
> device is closed in xen_blkif_free or some other place?

Can you add some debug prints to check if xen_blkif_disconnect is
indeed returning EBUSY (or some error) and that's preventing the
device from closing correctly?

Thanks, Roger.

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-users

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.