Activity log for bug #942788

Date Who What changed Old value New value Message
2012-02-28 18:09:14 Scott Moser bug added bug
2012-02-28 18:22:32 Steve Langasek util-linux (Ubuntu): status New Triaged
2012-02-28 18:22:34 Steve Langasek util-linux (Ubuntu): importance Undecided Medium
2012-02-28 18:22:43 Scott Moser attachment added output of 'udevadm monitor -e' during sfdisk https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/942788/+attachment/2791448/+files/udevadm-monitor-e.log
2012-02-28 18:24:34 Scott Moser description If you invoke sfdisk without --no-reread, you're almost guaranteed to have race conditions involved. Run the following as root: DEV=/dev/vdb # or some disk you don't have data on printf "1,,L,*\n" > sfdisk.in sudo udevadm settle; for((i=0;i<100;i++)); do sfdisk $DEV <sfdisk.in > out 2>&1 || { echo "FAILED: $i"; cat out; break; } ; echo -n .; udevadm settle; done You'll see failure at some point. The problem is that unless you pass '--no-reread', sfdisk checks if the device is busy by issuing a BLKRRPART ioctl on the device. That, in turn, causes a flurry of udev events that open the disk (such as 'blkid'). If those udev events don't finish before sfdisk writes the partition table and calls BLKRRPART again, the second call will fail. To prove that a single run is destined for race condition, turn udevadm debug on with: udevadm control --log-priority=debug and then just run: printf "1,,L,*\n" | sudo sfdisk $DEV That will show you output in /var/log/syslog that shows udev responding to events. ProblemType: Bug DistroRelease: Ubuntu 12.04 Package: util-linux 2.20.1-1ubuntu2 ProcVersionSignature: User Name 3.2.0-17.27-virtual 3.2.6 Uname: Linux 3.2.0-17-virtual x86_64 ApportVersion: 1.93-0ubuntu2 Architecture: amd64 Date: Tue Feb 28 17:36:40 2012 Ec2AMI: ami-00000000 Ec2AMIManifest: FIXME Ec2AvailabilityZone: nova Ec2InstanceType: m1.small Ec2Kernel: unavailable Ec2Ramdisk: unavailable ProcEnviron: TERM=screen PATH=(custom, user) LANG=en_US.UTF-8 SHELL=/bin/bash SourcePackage: util-linux UpgradeStatus: No upgrade log present (probably fresh install) If you invoke sfdisk without --no-reread, you're almost guaranteed to have race conditions involved. Run the following as root:   DEV=/dev/vdb # or some disk you don't have data on   printf "1,,L,*\n" > sfdisk.in   sudo udevadm settle;   for((i=0;i<100;i++)); do sfdisk $DEV <sfdisk.in > out 2>&1 ||      { echo "FAILED: $i"; cat out; break; } ; echo -n .; udevadm settle; done You'll see failure at some point. The problem is that unless you pass '--no-reread', sfdisk checks if the device is busy by issuing a BLKRRPART ioctl on the device. That, in turn, causes a flurry of udev events that open the disk (such as 'blkid'). If those udev events don't finish before sfdisk writes the partition table and calls BLKRRPART again, the second call will fail. To prove that a single run is destined for race condition, turn udevadm debug on with:   udevadm control --log-priority=debug and then just run:   printf "1,,L,*\n" | sudo sfdisk $DEV That will show you output in /var/log/syslog that shows udev responding to events. ProblemType: Bug DistroRelease: Ubuntu 12.04 Package: util-linux 2.20.1-1ubuntu2 ProcVersionSignature: User Name 3.2.0-17.27-virtual 3.2.6 Uname: Linux 3.2.0-17-virtual x86_64 ApportVersion: 1.93-0ubuntu2 Architecture: amd64 Date: Tue Feb 28 17:36:40 2012 Ec2AMI: ami-00000000 Ec2AMIManifest: FIXME Ec2AvailabilityZone: nova Ec2InstanceType: m1.small Ec2Kernel: unavailable Ec2Ramdisk: unavailable ProcEnviron:  TERM=screen  PATH=(custom, user)  LANG=en_US.UTF-8  SHELL=/bin/bash SourcePackage: util-linux UpgradeStatus: No upgrade log present (probably fresh install) Related Bugs: * bug 937352: cloud-initramfs-tools root partition may not be grown by growpart
2012-02-28 18:26:28 Scott Moser description If you invoke sfdisk without --no-reread, you're almost guaranteed to have race conditions involved. Run the following as root:   DEV=/dev/vdb # or some disk you don't have data on   printf "1,,L,*\n" > sfdisk.in   sudo udevadm settle;   for((i=0;i<100;i++)); do sfdisk $DEV <sfdisk.in > out 2>&1 ||      { echo "FAILED: $i"; cat out; break; } ; echo -n .; udevadm settle; done You'll see failure at some point. The problem is that unless you pass '--no-reread', sfdisk checks if the device is busy by issuing a BLKRRPART ioctl on the device. That, in turn, causes a flurry of udev events that open the disk (such as 'blkid'). If those udev events don't finish before sfdisk writes the partition table and calls BLKRRPART again, the second call will fail. To prove that a single run is destined for race condition, turn udevadm debug on with:   udevadm control --log-priority=debug and then just run:   printf "1,,L,*\n" | sudo sfdisk $DEV That will show you output in /var/log/syslog that shows udev responding to events. ProblemType: Bug DistroRelease: Ubuntu 12.04 Package: util-linux 2.20.1-1ubuntu2 ProcVersionSignature: User Name 3.2.0-17.27-virtual 3.2.6 Uname: Linux 3.2.0-17-virtual x86_64 ApportVersion: 1.93-0ubuntu2 Architecture: amd64 Date: Tue Feb 28 17:36:40 2012 Ec2AMI: ami-00000000 Ec2AMIManifest: FIXME Ec2AvailabilityZone: nova Ec2InstanceType: m1.small Ec2Kernel: unavailable Ec2Ramdisk: unavailable ProcEnviron:  TERM=screen  PATH=(custom, user)  LANG=en_US.UTF-8  SHELL=/bin/bash SourcePackage: util-linux UpgradeStatus: No upgrade log present (probably fresh install) Related Bugs: * bug 937352: cloud-initramfs-tools root partition may not be grown by growpart If you invoke sfdisk without --no-reread, you're almost guaranteed to have race conditions involved. Run the following as root:   DEV=/dev/vdb # or some disk you don't have data on   printf "1,,L,*\n" > sfdisk.in   sudo udevadm settle;   for((i=0;i<100;i++)); do sfdisk $DEV <sfdisk.in > out 2>&1 ||      { echo "FAILED: $i"; cat out; break; } ; echo -n .; udevadm settle; done You'll see failure at some point. The problem is that unless you pass '--no-reread', sfdisk checks if the device is busy by issuing a BLKRRPART ioctl on the device. That, in turn, causes a flurry of udev events that open the disk (such as 'blkid'). If those udev events don't finish before sfdisk writes the partition table and calls BLKRRPART again, the second call will fail. To prove that a single run is destined for race condition, turn udevadm debug on with:   udevadm control --log-priority=debug and then just run:   sfdisk --re-read $DEV or blockdev --rereadpt $DEV That will show you output in /var/log/syslog that shows udev responding to events. ProblemType: Bug DistroRelease: Ubuntu 12.04 Package: util-linux 2.20.1-1ubuntu2 ProcVersionSignature: User Name 3.2.0-17.27-virtual 3.2.6 Uname: Linux 3.2.0-17-virtual x86_64 ApportVersion: 1.93-0ubuntu2 Architecture: amd64 Date: Tue Feb 28 17:36:40 2012 Ec2AMI: ami-00000000 Ec2AMIManifest: FIXME Ec2AvailabilityZone: nova Ec2InstanceType: m1.small Ec2Kernel: unavailable Ec2Ramdisk: unavailable ProcEnviron:  TERM=screen  PATH=(custom, user)  LANG=en_US.UTF-8  SHELL=/bin/bash SourcePackage: util-linux UpgradeStatus: No upgrade log present (probably fresh install) Related Bugs:   * bug 937352: cloud-initramfs-tools root partition may not be grown by growpart