]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xen-blkback: report hotplug-status busy when detach is initiated but frontend device...
authorNiranjan Patil <niranjan.d.patil@oracle.com>
Thu, 23 Mar 2017 15:57:24 +0000 (08:57 -0700)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 1 Jun 2017 06:07:21 +0000 (23:07 -0700)
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 <niranjan.d.patil@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/block/xen-blkback/xenbus.c

index 69c8b239e684ef5cab1bc2f581616dfd85938160..c6a5bceee22d698f65c2f5c4e497b543e766eb68 100644 (file)
@@ -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;