commonio: force lock file sync

lib/commonio.c: after writing to the lock file, force a file sync to
the storage system.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1862056
This commit is contained in:
ikerexxe 2020-11-02 17:08:55 +01:00
parent f8642a1986
commit fb0f702cbf

View File

@ -157,7 +157,17 @@ static int do_lock_file (const char *file, const char *lock, bool log)
if (write (fd, buf, (size_t) len) != len) {
if (log) {
(void) fprintf (stderr,
"%s: %s: %s\n",
"%s: %s file write error: %s\n",
Prog, file, strerror (errno));
}
(void) close (fd);
unlink (file);
return 0;
}
if (fdatasync (fd) == -1) {
if (log) {
(void) fprintf (stderr,
"%s: %s file sync error: %s\n",
Prog, file, strerror (errno));
}
(void) close (fd);