diff options
author | Karel Zak | 2010-01-06 11:12:43 +0100 |
---|---|---|
committer | Karel Zak | 2010-01-06 11:12:43 +0100 |
commit | e90709421ac86e2e81498143f75734e0b79f76d1 (patch) | |
tree | ee6cac22d8b65cea4b9363b3a5371a70dd24c16d /fdisk/sfdisk.c | |
parent | mount: fix typo in mount.8 (diff) | |
download | kernel-qcow2-util-linux-e90709421ac86e2e81498143f75734e0b79f76d1.tar.gz kernel-qcow2-util-linux-e90709421ac86e2e81498143f75734e0b79f76d1.tar.xz kernel-qcow2-util-linux-e90709421ac86e2e81498143f75734e0b79f76d1.zip |
fdisk: sleep-after-sync and fsync usage
It seems that sleep() after sync() is unnecessary legacy. It's very
probably unnecessary since kernel 1.3.20. For example the libparted
does not to use sleep() at all.
It seems that more important is fsync() usage in fdisks. For more
details see
http://marc.theaimsgroup.com/?l=linux-kernel&m=105545785306867&w=3
http://marc.theaimsgroup.com/?l=linux-kernel&m=105545848607353&w=3
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=276369
Currently we use fsync() in fdisk only. This patch also add fsync() to
sfdisk and cfdisk.
Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=276369
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=502639
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisk/sfdisk.c')
-rw-r--r-- | fdisk/sfdisk.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c index 0652cfa3a..6ac91f07b 100644 --- a/fdisk/sfdisk.c +++ b/fdisk/sfdisk.c @@ -806,14 +806,13 @@ reread_disk_partition(char *dev, int fd) { printf(_("Re-reading the partition table ...\n")); fflush(stdout); sync(); - sleep(3); /* superfluous since 1.3.20 */ if (reread_ioctl(fd) && is_blockdev(fd)) do_warn(_("The command to re-read the partition table failed.\n" "Run partprobe(8), kpartx(8) or reboot your system now,\n" "before using mkfs\n")); - if (close(fd)) { + if (fsync(fd) || close(fd)) { perror(dev); do_warn(_("Error closing %s\n"), dev); } @@ -3103,6 +3102,5 @@ do_fdisk(char *dev){ "(See fdisk(8).)\n")); sync(); /* superstition */ - sleep(3); exit(exit_status); } |