Call blockdev --rereadpt then udev_settle after sfdisk commands.
authorRichard W.M. Jones <rjones@redhat.com>
Fri, 24 Sep 2010 17:53:21 +0000 (18:53 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Fri, 24 Sep 2010 18:11:56 +0000 (19:11 +0100)
This updates commit 956fc5a3feacc970ea763697bf28fb686c875408 so
that we call udev_settle after rereading the partition table.  This
ensures that the devices nodes for the new partitions have been
created.

daemon/sfdisk.c

index 99a18bb..bf62c1d 100644 (file)
@@ -89,8 +89,6 @@ sfdisk (const char *device, int n, int cyls, int heads, int sectors,
     return -1;
   }
 
     return -1;
   }
 
-  udev_settle ();
-
   /* sfdisk sometimes fails on fast machines with:
    *
    * Re-reading the partition table ...
   /* sfdisk sometimes fails on fast machines with:
    *
    * Re-reading the partition table ...
@@ -103,7 +101,12 @@ sfdisk (const char *device, int n, int cyls, int heads, int sectors,
    * other component.  In any case, reread the partition table
    * unconditionally here.
    */
    * other component.  In any case, reread the partition table
    * unconditionally here.
    */
-  return do_blockdev_rereadpt (device);
+  if (do_blockdev_rereadpt (device) == -1)
+    return -1;
+
+  udev_settle ();
+
+  return 0;
 }
 
 int
 }
 
 int