[PATCH] libmultipath: sync before reboot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If reboot within 5s of registering prkey, there will some zero
be added to /etc/multipath/prkeys. The reason is that cache is
not flushed to the disk.

Here fsync(fd) to fix it.

Signed-off-by: Lixiaokeng <lixiaokeng@xxxxxxxxxx>
Signed-off-by: Jianbing Jiao <jiangjianbiang@xxxxxxxxxx>
---
 libmultipath/util.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libmultipath/util.c b/libmultipath/util.c
index ea858409..f7e9c783 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -368,6 +368,11 @@ int safe_write(int fd, const void *buf, size_t count)
 		count -= r;
 		buf = (const char *)buf + r;
 	}
+
+	if (fsync(fd) < 0) {
+		condlog(0, "failed to fsync fd :%d", fd);
+		return -errno;
+	}
 	return 0;
 }

-- 

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux