OSDN Git Service

linux: remove DASD restriction on _disk_sync_part_table
authorBrian C. Lane <bcl@redhat.com>
Mon, 22 Nov 2010 09:01:56 +0000 (10:01 +0100)
committerJim Meyering <meyering@redhat.com>
Mon, 22 Nov 2010 11:09:42 +0000 (12:09 +0100)
* libparted/arch/linux.c: Include <assert.h>.
(linux_disk_commit): Assert that _have_blkpg returns true
and don't skip _disk_sync_part_table for DASD devices.
Otherwise, when creating a partition on a DASD device,
new /dev/*[12...] device files would not be created.
Also, remove obsolete comment about DevFS.
For details, see http://bugzilla.redhat.com/651478
and http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10191

libparted/arch/linux.c

index a5ae10c..4e61bfe 100644 (file)
@@ -40,6 +40,7 @@
 #include <sys/types.h>
 #include <sys/utsname.h>        /* for uname() */
 #include <scsi/scsi.h>
+#include <assert.h>
 #ifdef ENABLE_DEVICE_MAPPER
 #include <libdevmapper.h>
 #endif
@@ -2824,20 +2825,15 @@ linux_disk_commit (PedDisk* disk)
                 return _dm_reread_part_table (disk);
 #endif
         if (disk->dev->type != PED_DEVICE_FILE) {
-                /* The ioctl() command BLKPG_ADD_PARTITION does not notify
-                 * the devfs system; consequently, /proc/partitions will not
-                 * be up to date, and the proper links in /dev are not
-                 * created.  Therefore, if using DevFS, we must get the kernel
-                 * to re-read and grok the partition table.
-                 */
-                /* Work around kernel dasd problem so we really do BLKRRPART */
-               int ok = 1;
-               if (disk->dev->type != PED_DEVICE_DASD && _have_blkpg ()) {
-                       if (!_disk_sync_part_table (disk))
-                         ok = 0;
-               }
 
-                return ok;
+               /* We now require BLKPG support.  If this assertion fails,
+                  please write to the mailing list describing your system.
+                  Assuming it's never triggered, ...
+                  FIXME: remove this assertion in 2012.  */
+               assert (_have_blkpg ());
+
+               if (!_disk_sync_part_table (disk))
+                       return 0;
         }
 
         return 1;