[parted-devel] Warning message if create partition when a partition is mounted
Jim Meyering
jim at meyering.net
Mon Oct 19 20:03:09 UTC 2009
Curtis Gedak wrote:
> Hi Jim,
>
> Recently I have made some time to dig further into this change in
> behaviour. Following is a description of where the change in
> behaviour was introduced.
>
>
> Using GParted as a starting point, I have been able to trace the
> change in behaviour to a call to the function ped_disk_commit_to_os()
> in the file libparted/disk.c.
>
> This function in turn calls ped_architecture->disk_ops->disk_commit()
> which in the case of linux is stored in libparted/arch/linux.c.
>
> I believe the change in behaviour is due to the removal of the
> following code (and many supporting functions) from the function
> linux_disk_commit():
>
> /* 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 */
> if (disk->dev->type != PED_DEVICE_DASD &&
> _have_blkpg () && !_have_devfs ()) {
> if (_disk_sync_part_table (disk))
> return 1;
> }
>
>
> Without this code, the function _linux_disk_commit() returns a value of 0.
>
> This change was introduced with the following commit:
> http://git.debian.org/?p=parted/parted.git;a=commitdiff;h=1d8f9bece138e4d8e58f7b059b4195aff6f39deb;hp=d16300a88d9200e0f1e08d56e39392e028412611
>
> To confirm that this indeed the source of the change in behaviour, I
> started with a the BETA parted-2.0 tarball and then re-introduced the
> code that was removed by this commit. Lo and behold, the change in
> behaviour disappears. Specifically the warning message no longer
> appears when a new partition is created on a device that has at least
> one partition mounted.
>
> Unfortunately this commit involves the removal of much code, and is
> quite complex in nature. As a consequence I am unsure of how this
> problem should be addressed.
>
> Your thoughts on this would be appreciated.
Hi Curtis,
Please explain why you care.
As I've said repeatedly, I think it's an advantage to be warned when doing
something like that. That you are pursuing this issue makes me think
you must have a compelling use case that requires modifying a partition
table while one of its partitions is mounted. If so, please describe it.
More information about the parted-devel
mailing list