diff mbox series

um: use fdatasync() when mapping the UBD FSYNC command

Message ID 20200422160001.13200-1-anton.ivanov@cambridgegreys.com
State Accepted
Headers show
Series um: use fdatasync() when mapping the UBD FSYNC command | expand

Commit Message

Anton Ivanov April 22, 2020, 4 p.m. UTC
From: Anton Ivanov <anton.ivanov@cambridgegreys.com>

We do not need to update the metadata (atime, mtime, etc)
on the UBD file and/or the COW file until UML exits.

UBD image mtime is checked in UML only when opening
the files. After that they are locked and used
exclusively by a single UML instance, so there is
no point wasting resources on updating metadata on
every sync. We can sync data only. The host will
always update mtime if a file has been modified upon
closing it.

Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
 arch/um/os-Linux/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series


diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index fbda10535dab..538c7765323b 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -286,7 +286,7 @@  int os_write_file(int fd, const void *buf, int len)
 int os_sync_file(int fd)
-	int n = fsync(fd);
+	int n = fdatasync(fd);
 	if (n < 0)
 		return -errno;