From 32c4626c4c34a7deb9ddc5edfba98c3f171900c8 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 22 Sep 2020 11:21:27 +0200 Subject: [PATCH] shutdown: also fsync() MD devices when going down Let's make this explicit, just in case this suffers by the same issues as the loopback devices, and drops in-flight IO when we disassemble it. --- src/shutdown/umount.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shutdown/umount.c b/src/shutdown/umount.c index 43544857283..89b05fcc3fb 100644 --- a/src/shutdown/umount.c +++ b/src/shutdown/umount.c @@ -484,6 +484,9 @@ static int delete_md(MountPoint *m) { if (fd < 0) return -errno; + if (fsync(fd) < 0) + log_debug_errno(errno, "Failed to sync MD block device %s, ignoring: %m", m->path); + if (ioctl(fd, STOP_ARRAY, NULL) < 0) return -errno; -- 2.47.3