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/cfdisk.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/cfdisk.c')
-rw-r--r-- | fdisk/cfdisk.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c index 0405e1261..eec16893c 100644 --- a/fdisk/cfdisk.c +++ b/fdisk/cfdisk.c @@ -406,9 +406,11 @@ partition_type_text(int i) { static void fdexit(int ret) { - if (opened) + if (opened) { + if (changed) + fsync(fd); close(fd); - + } if (changed) { fprintf(stderr, _("Disk has been changed.\n")); #if 0 @@ -1912,12 +1914,10 @@ write_part_table(void) { if (is_bdev) { #ifdef BLKRRPART sync(); - sleep(2); if (!ioctl(fd,BLKRRPART)) changed = TRUE; #endif sync(); - sleep(4); clear_warning(); if (changed) |