[PATCH 1/4] src/t_rename_overwrite: fsync to flush the rename operation result

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



The generic/035 fails on glusterfs due to glusterfs (or others like
it), the file state can't be updated in time in client side, there's
time delay. So call fsync to get the right file state after rename.

Signed-off-by: Zorro Lang <zlang@xxxxxxxxxx>
---
 src/t_rename_overwrite.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/t_rename_overwrite.c b/src/t_rename_overwrite.c
index c5cdd1db..8dcf8d46 100644
--- a/src/t_rename_overwrite.c
+++ b/src/t_rename_overwrite.c
@@ -2,6 +2,7 @@
 #include <fcntl.h>
 #include <err.h>
 #include <sys/stat.h>
+#include <unistd.h>
 
 int main(int argc, char *argv[])
 {
@@ -25,6 +26,7 @@ int main(int argc, char *argv[])
 	res = rename(path1, path2);
 	if (res == -1)
 		err(1, "rename(\"%s\", \"%s\")", path1, path2);
+	fsync(fd);
 
 	res = fstat(fd, &stbuf);
 	if (res == -1)
-- 
2.31.1




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux