sfdisk, re-eading partition table fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

our test suite shows that many sfdisk tests fail sometimes to "Re-read
partition table" at the end. I was able to find some systems where
I could re-produce the problem using the script below.

Seems that the problem is because of the first BLKRRPART ioctl call
in sfdisk.c function is_device_used(). Maybe it cause udev or
whatever to open the device and then the real BLKRRPART in
write_changes() fails.

Removing the first BLKRRPART ioctl (or sleeping about 50ms after the first one)
"fixes" the issue.

------ my test script -------------
#!/bin/bash
export LANG="C"
export LC_ALL="C"

export LD_LIBRARY_PATH=/home/rudi/devel/util-linux/build/.libs
SFDISK=/home/rudi/devel/util-linux/build/.libs/sfdisk
LOG=/tmp/sfdisk.log

modprobe -r scsi_debug || exit 1
modprobe -b scsi_debug dev_size_mb=100 sector_size=512 || exit 1
udevadm settle
sleep 2
DEVICE=/dev/$(grep --with-filename scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
echo device: $DEVICE

rm -f "$LOG"

# create a partition
echo ',+,L' | $SFDISK --label dos ${DEVICE} &> /dev/null
udevadm settle
sleep 2

echo "+10M,-10M" | strace -f -o /tmp/strace $SFDISK -N1 ${DEVICE} >> "$LOG" 2>&1
if grep -qi "failed" "$LOG"; then 
	echo "!! FAILED !!"
	exit 1
fi
exit 0
----------

cu,
Rudi
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux