]> xenbits.xensource.com Git - xen.git/commitdiff
hotplug: Restore block-tap phy compatibility (again)
authorJason Andryuk <jason.andryuk@amd.com>
Wed, 24 Jul 2024 09:36:04 +0000 (11:36 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 24 Jul 2024 09:36:04 +0000 (11:36 +0200)
"$dev" needs to be set correctly for backendtype=phy as well as
backendtype=tap.  Move the setting into the conditional, so it can be
handled properly for each.

(dev could be captured during tap-ctl allocate for blktap module, but it
would not be set properly for the find_device case.  The backendtype=tap
case would need to be handled regardless.)

Fixes: f16ac12bd418 ("hotplug: Restore block-tap phy compatibility")
Fixes: 76a484193dbb ("hotplug: Update block-tap")
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
tools/hotplug/Linux/block-tap

index 8661ce77e30df17d46bb8ed7713cfdfd622601af..95970a61f65f3c613a411e563315f8e082aa2938 100755 (executable)
@@ -204,13 +204,13 @@ add()
         tap_create
     fi
 
-    # Create nbd unix path.  find_device/tap_create set pid & minor
-    dev=$( printf "/run/blktap-control/nbd%ld.%d" "$pid" "$minor" )
-
     xenstore_write "$XENBUS_PATH/pid" "$pid"
     xenstore_write "$XENBUS_PATH/minor" "$minor"
 
     if [ "$XENBUS_TYPE" = "vbd3" ] ; then
+        # Create nbd unix path.  find_device/tap_create set pid & minor
+        dev=$( printf "/run/blktap-control/nbd%ld.%d" "$pid" "$minor" )
+
         # $dev, as a unix socket, has major:minor 0:0.  If write_dev writes
         # physical-device, tapback would use that incorrect minor 0.  So don't
         # write physical-device.
@@ -218,6 +218,9 @@ add()
 
         success
     else
+        # Construct dev path from minor
+        dev="/dev/xen/blktap-2/tapdev$minor"
+        [ -b "$dev" ] || fatal "blktap \"$dev\" is not a block dev"
         write_dev "$dev"
     fi