@@ -3576,22 +3576,33 @@ udisks_linux_block_handle_format (UDisksBlock *block,
3576
3576
/* The mkfs program may not generate all the uevents we need - so explicitly
3577
3577
* trigger an event here
3578
3578
*/
3579
- if (fs_features && (fs_features -> features & BD_FS_FEATURE_PARTITION_TABLE ) == BD_FS_FEATURE_PARTITION_TABLE &&
3580
- !udisks_linux_block_object_reread_partition_table (UDISKS_LINUX_BLOCK_OBJECT (object ), & error ))
3579
+ if (fs_features && (fs_features -> features & BD_FS_FEATURE_PARTITION_TABLE ) == BD_FS_FEATURE_PARTITION_TABLE )
3581
3580
{
3582
- udisks_warning ("%s" , error -> message );
3583
- g_clear_error (& error );
3581
+ UDisksObject * partition_table_object ;
3582
+
3583
+ /* If formatting a partition, re-read partition table on a parent device */
3584
+ if (partition != NULL )
3585
+ partition_table_object = udisks_daemon_find_object (daemon , udisks_partition_get_table (partition ));
3586
+ else
3587
+ partition_table_object = g_object_ref (object );
3588
+
3589
+ if (partition_table_object != NULL )
3590
+ {
3591
+ if (!udisks_linux_block_object_reread_partition_table (UDISKS_LINUX_BLOCK_OBJECT (partition_table_object ), & error ))
3592
+ {
3593
+ udisks_warning ("%s" , error -> message );
3594
+ g_clear_error (& error );
3595
+ }
3596
+ if (partition_table_object != object )
3597
+ udisks_linux_block_object_trigger_uevent_sync (UDISKS_LINUX_BLOCK_OBJECT (partition_table_object ),
3598
+ UDISKS_DEFAULT_WAIT_TIMEOUT );
3599
+ trigger_uevent_on_nested_partitions (daemon , UDISKS_LINUX_BLOCK_OBJECT (partition_table_object ));
3600
+ g_object_unref (partition_table_object );
3601
+ }
3584
3602
}
3585
3603
udisks_linux_block_object_trigger_uevent_sync (UDISKS_LINUX_BLOCK_OBJECT (object_to_mkfs ),
3586
3604
UDISKS_DEFAULT_WAIT_TIMEOUT );
3587
3605
3588
- /* In case a protective partition table was potentially created, trigger uevents
3589
- * on all nested partitions. */
3590
- if (fs_features && (fs_features -> features & BD_FS_FEATURE_PARTITION_TABLE ) == BD_FS_FEATURE_PARTITION_TABLE )
3591
- {
3592
- trigger_uevent_on_nested_partitions (daemon , UDISKS_LINUX_BLOCK_OBJECT (object ));
3593
- }
3594
-
3595
3606
/* Wait for the desired filesystem interface */
3596
3607
wait_data .object = object_to_mkfs ;
3597
3608
wait_data .type = type ;
0 commit comments