Remove O_SYNC from device open and use fsync().

This speed up wipe operation considerably.
This commit is contained in:
Milan Broz
2018-08-09 12:01:20 +02:00
parent 5b5a64361f
commit 69a844c654
10 changed files with 29 additions and 5 deletions

View File

@@ -378,8 +378,10 @@ int LUKS_hdr_restore(
/* Be sure to reload new data */
r = LUKS_read_phdr(hdr, 1, 0, ctx);
out:
if (devfd >= 0)
if (devfd >= 0) {
device_sync(device, devfd);
close(devfd);
}
crypt_safe_free(buffer);
return r;
}
@@ -681,6 +683,8 @@ int LUKS_write_phdr(struct luks_phdr *hdr,
&convHdr, hdr_size) < hdr_size ? -EIO : 0;
if (r)
log_err(ctx, _("Error during update of LUKS header on device %s."), device_path(device));
device_sync(device, devfd);
close(devfd);
/* Re-read header from disk to be sure that in-memory and on-disk data are the same. */