All of lore.kernel.org
 help / color / mirror / Atom feed
* sfdisk, re-eading partition table fails
@ 2015-12-14 12:11 Ruediger Meier
  2015-12-15 10:24 ` Karel Zak
  0 siblings, 1 reply; 5+ messages in thread
From: Ruediger Meier @ 2015-12-14 12:11 UTC (permalink / raw)
  To: util-linux

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-12-18 14:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-14 12:11 sfdisk, re-eading partition table fails Ruediger Meier
2015-12-15 10:24 ` Karel Zak
2015-12-15 12:26   ` Ruediger Meier
2015-12-15 13:33     ` Karel Zak
2015-12-18 14:32     ` Ruediger Meier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.