From: Niranjan Patil Date: Thu, 23 Mar 2017 15:57:24 +0000 (-0700) Subject: xen-blkback: report hotplug-status busy when detach is initiated but frontend device... X-Git-Tag: v4.1.12-102.0.20170601_1400~232 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5a3f484d740df8527a187b2d0d7a96eb51fd1931;p=users%2Fjedix%2Flinux-maple.git xen-blkback: report hotplug-status busy when detach is initiated but frontend device is busy. In case of deferred detach xm/xend doesn't get notified about busy status and has to wait timeout (default 100s) to report detach failure to user. This behavior is sometime incorrectly interpreted as tool hang. This patch updates the hotplug-status with busy so that xm gets notified instead of timeout. Orabug: 26072430 Signed-off-by: Niranjan Patil Reviewed-by: Konrad Rzeszutek Wilk --- diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 69c8b239e684e..c6a5bceee22d6 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -799,6 +799,20 @@ static void frontend_changed(struct xenbus_device *dev, break; case XenbusStateClosing: + if (!xenbus_dev_is_online(dev)) { + /* + * Toolstack initiated detach (online = 0) but frontend + * device is busy. Report this with status busy so that + * toolstack waiting on hotplug-status will be notified + * instead of wait timeout. + */ + err = xenbus_write(XBT_NIL, dev->nodename, + "hotplug-status", "busy"); + if (err) + xenbus_dev_error(dev, err, + "writing %s/hotplug-status", + dev->nodename); + } xenbus_switch_state(dev, XenbusStateClosing); break;