From: Ruediger Meier <sweet_f_a@gmx.de>
To: util-linux@vger.kernel.org
Subject: sfdisk, re-eading partition table fails
Date: Mon, 14 Dec 2015 13:11:59 +0100 [thread overview]
Message-ID: <201512141311.59328.sweet_f_a@gmx.de> (raw)
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
next reply other threads:[~2015-12-14 12:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-14 12:11 Ruediger Meier [this message]
2015-12-15 10:24 ` sfdisk, re-eading partition table fails Karel Zak
2015-12-15 12:26 ` Ruediger Meier
2015-12-15 13:33 ` Karel Zak
2015-12-18 14:32 ` Ruediger Meier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201512141311.59328.sweet_f_a@gmx.de \
--to=sweet_f_a@gmx.de \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.