multipath-tools/0013-bugfix-flush-and-sync-before-reboot.patch

18 lines
391 B
Diff
Raw Normal View History

2020-01-10 17:13:17 +08:00
diff --git a/libmultipath/util.c b/libmultipath/util.c
index 8d8fcc8..3c284b7 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -463,5 +463,12 @@ int safe_write(int fd, const void *buf, size_t count)
count -= r;
buf = (const char *)buf + r;
}
+
+ /* sync->disk */
+ if (fsync(fd) < 0) {
+ condlog(0, "failed to fsync fd :%d", fd);
+ return -errno;
+ }
+
return 0;
}