>From 1cf9d072cdd4d17c620834864f79ec5a0765d2bf Mon Sep 17 00:00:00 2001 From: Dongsheng Yang Date: Fri, 18 Sep 2015 08:40:49 -0400 Subject: [PATCH] quotacheck: sync files in quotacheck. After a quotacheck, we need to make kernel to see the modification. Compared with syncing quota files in kernel, we would rather sync it in quotacheck command. Signed-off-by: Dongsheng Yang --- quotacheck.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/quotacheck.c b/quotacheck.c index 6f34cff..e4b184d 100644 --- a/quotacheck.c +++ b/quotacheck.c @@ -768,6 +768,20 @@ rename_new: close(fd); } #endif + + /* Do a syncing for the quota file */ + if ((fd = open(filename, O_RDWR)) < 0) { + errstr(_("Cannot open new quota file %s: %s\n"), filename, strerror(errno)); + free(filename); + return -1; + } + if (fsync(fd)) { + errstr(_("Cannot sync quota file %s: %s\n"), filename, strerror(errno)); + free(filename); + return -1; + } + close(fd); + free(filename); return 0; } -- 1.8.3.1