Re: [PATCH 2/2] block: avoid to drop & re-add partitions if partitions aren't changed

From: Ming Lei
Date: Fri Feb 05 2021 - 02:32:45 EST


On Fri, Feb 05, 2021 at 08:14:29AM +0100, Christoph Hellwig wrote:
> On Fri, Feb 05, 2021 at 10:17:08AM +0800, Ming Lei wrote:
> > block ioctl(BLKRRPART) always drops current partitions and adds
> > partitions again, even though there isn't any change in partitions table.
> >
> > ioctl(BLKRRPART) may be called by systemd-udevd and some disk utilities
> > frequently.
>
> Err, why? We should probably fix udev to not do stupid things first.

It is one standard syscall, and the command is just for re-read
partition table, and it can be called by any application, fdisk
calls it too even though no any change done on the disk data,
same with parted, and there should be more.

#define BLKRRPART _IO(0x12,95) /* re-read partition table */

IMO, this syscall isn't supposed to drop partitions if user doesn't
touch the partition table, do you think it is one sane behavior to
drop partitions at will?

--
Ming