fdisk reinstate sleep

Bob Dunlop bob.dunlop at xyzzy.org.uk
Mon Jul 11 15:45:48 UTC 2011


Hi,

I've been chasing an intermittent problem with busybox's fdisk
implementation.  About one command in ten was failing on me when used
with slow external USB disks on a 320MHz ARM system.  The BLKRRPART
ioctl was returning device busy.

I traced it to a commented out sleep(2) in fdisk.c.  With the sleep
reinstated fdisk is reliable.

I know that linux sync() is documented as not returning until the buffers
have been flushed but I think something is delaying them, possibly in the
USB stack.


--- busybox-1.18.3/util-linux/fdisk.c-orig	2011-07-11 14:51:15.000000000 +0100
+++ busybox-1.18.3/util-linux/fdisk.c	2011-07-11 14:51:52.000000000 +0100
@@ -2564,7 +2564,7 @@
 
 	printf("Calling ioctl() to re-read partition table\n");
 	sync();
-	/* sleep(2); Huh? */
+	sleep(2);
 	i = ioctl_or_perror(dev_fd, BLKRRPART, NULL,
 			"WARNING: rereading partition table "
 			"failed, kernel still uses old table");

-- 
        Bob Dunlop


More information about the busybox mailing list