Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1832157 - fdisk fails to re-read partition table
Summary: fdisk fails to re-read partition table
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: device-mapper-multipath
Version: rawhide
Hardware: s390x
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: LVM and device-mapper development team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: ZedoraTracker
TreeView+ depends on / blocked
 
Reported: 2020-05-06 08:39 UTC by Dan Horák
Modified: 2020-05-07 07:15 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-07 07:15:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
strace log (67.46 KB, text/plain)
2020-05-06 08:39 UTC, Dan Horák
no flags Details

Description Dan Horák 2020-05-06 08:39:03 UTC
Created attachment 1685599 [details]
strace log

Adding new partition on a multipathed zFCP disk with fdisk fails. I believe I saw same issue after cleaning partitions with wipefs.

[root@rock-kvmlp-fedora ~]# strace -o /tmp/fdisk.log fdisk /dev/mapper/mpathb

Welcome to fdisk (util-linux 2.35.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xe3106171.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-41943039, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-41943039, default 41943039): 

Created a new partition 1 of type 'Linux' and of size 20 GiB.

Command (m for help): w
The partition table has been altered.
Failed to add partition 1 to system: Invalid argument

The kernel still uses the old partitions. The new table will be used at the next reboot. 
Syncing disks.

[root@rock-kvmlp-fedora ~]# lsblk
NAME                                  MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sda                                     8:0    0  100G  0 disk  
└─mpatha                              253:0    0  100G  0 mpath 
  ├─mpatha1                           253:3    0    1G  0 part  /boot
  └─mpatha2                           253:4    0   99G  0 part  
    ├─fedora_rock--kvmlp--fedora-root 253:5    0 61.2G  0 lvm   /
    ├─fedora_rock--kvmlp--fedora-swap 253:6    0    8G  0 lvm   [SWAP]
    └─fedora_rock--kvmlp--fedora-home 253:7    0 29.9G  0 lvm   /home
sdb                                     8:16   0   20G  0 disk  
└─mpathb                              253:1    0   20G  0 mpath 
  └─mpathb1                           253:8    0   20G  0 part  
sdc                                     8:32   0   20G  0 disk  
└─mpathc                              253:2    0   20G  0 mpath 
sdd                                     8:48   0  100G  0 disk  
└─mpatha                              253:0    0  100G  0 mpath 
  ├─mpatha1                           253:3    0    1G  0 part  /boot
  └─mpatha2                           253:4    0   99G  0 part  
    ├─fedora_rock--kvmlp--fedora-root 253:5    0 61.2G  0 lvm   /
    ├─fedora_rock--kvmlp--fedora-swap 253:6    0    8G  0 lvm   [SWAP]
    └─fedora_rock--kvmlp--fedora-home 253:7    0 29.9G  0 lvm   /home
sde                                     8:64   0   20G  0 disk  
└─mpathb                              253:1    0   20G  0 mpath 
  └─mpathb1                           253:8    0   20G  0 part  
sdf                                     8:80   0   20G  0 disk  
└─mpathc                              253:2    0   20G  0 mpath 



Version-Release number of selected component (if applicable):
util-linux-2.35.1-7.fc32.s390x

Comment 1 Karel Zak 2020-05-06 12:50:19 UTC
Strange.

libfdisk uses BLKRRPART to detect if the device is used, it ends with error:

     ioctl(3, BLKRRPART) = -1 EINVAL (Invalid argument)

then after partition table modification it uses BLKPG_{ADD,RESIZE,DEL}_PARTITION ioctls to inform the system about changes. These ioctls fail too:

     ioctl(3, BLKPG, {op=BLKPG_ADD_PARTITION, flags=0, datalen=152, data={start=1048576, length=104857600, pno=1, devname="", volname=""}}) = -1 EINVAL (Invalid argument)

The most strange is that after all these failed syscalls the partition has been added to the system

     # lsblk /dev/mapper/mpathb
     NAME      MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
     mpathb    253:1    0   20G  0 mpath 
     └─mpathb1 253:8    0  100M  0 part  

(tried with 100MiB partition after reboot).

And now the craziest thing -- if I use "sfdisk --no-tell-kernel --no-reread" to avoid these ioctls than the partition node is still created.

  # echo ',200MiB,L' | sfdisk --append --no-tell-kernel --no-reread  /dev/mapper/mpathb
  ...
  Disklabel type: gpt
  Disk identifier: 8A4F4EE2-C34F-E543-88DC-09ACC9C1A39C

  Old situation:
  Device               Start    End Sectors  Size Type
  /dev/mapper/mpathb1   2048 411647  409600  200M Linux filesystem
  /dev/mapper/mpathb2 411648 821247  409600  200M Linux filesystem

  New situation:
  Device                    Start     End Sectors  Size Type
  /dev/mapper/mpathb1        2048  411647  409600  200M Linux filesystem
  /dev/mapper/mpathb2      411648  821247  409600  200M Linux filesystem
  /dev/mapper/mpathb-part3 821248 1230847  409600  200M Linux filesystem

  The partition table has been altered.

kernel's point of view:

  # lsblk /dev/mapper/mpathb
  NAME      MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
  mpathb    253:1    0   20G  0 mpath 
  ├─mpathb1 253:8    0  200M  0 part  
  ├─mpathb2 253:9    0  200M  0 part  
  └─mpathb3 253:10   0  200M  0 part  

Note, this is not standard behavior on other devices. It seems like mpath (or HW behind it) automatically creates partition nodes. There is nothing in dmesg(1)/journal output.

Comment 2 Karel Zak 2020-05-06 12:52:48 UTC
Reassigning to multipath guys.

Comment 3 Ben Marzinski 2020-05-06 17:15:25 UTC
There are no true partitions for device-mapper devices. They are instead linear-type device-mapper devices that are created by kpartx with a special UUID that marks them as "partitions" of another device-mapper device.  These are automatically created for multipath devices. When a multipath device is first created or whenever it gets a uevent that wasn't triggered by device-mapper itself. there is a udev rule (/lib/udev/rules.d/66-kpartx.rules) that will run kpartx to update the partition devices associated with the multipath device.  If you use parted instead of fdisk, it understands device-mapper devices, and will automatically create the partition devices itself, instead of throwing an error. fdisk could do the same thing. But as long a uevent gets sent, kpartx should reload the partitions.

So, what's the bug here? Are you wanting the multipath device to not have its partitions updated?

Comment 4 Karel Zak 2020-05-07 07:15:09 UTC
OK, thanks for the information. It would be nice to have somewhere any log message, but it's nothing important. Closing.


Note You need to log in before you can comment on or make changes to this bug.