[dm-devel] [PATCH 6/6] flush and sync before reboot
lixiaokeng
lixiaokeng at huawei.com
Mon Oct 26 09:28:28 UTC 2020
Write to /etc/multipath/prkeys, for example
0x0000000000000001 3620f17c1007609293677bb210000058e.
Power-off and restart in 5 seconds. There will
be some 0 byte in /etc/multipath/prkeys.
Here we flush and sync before reboot.
Signed-off-by: Jianbing Jiao <jiangjianbiang at huawei.com>
Signed-off-by: Lixiaokeng <lixiaokeng at huawei.com>
---
libmultipath/util.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libmultipath/util.c b/libmultipath/util.c
index 1dad90f2..11d4a398 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -355,6 +355,13 @@ 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;
}
--
More information about the dm-devel
mailing list