summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-02-15 10:09:33 -0200
committerRenato Botelho <renato@netgate.com>2016-02-15 10:09:33 -0200
commit3882f7f0612f5660c6287cfa1ba025f2843a1957 (patch)
tree4a7ea983015b41e77a7b27f46ca6adb2dd76b42e /lib
parent51145f6d236c6fef7e3df24ff1ed1947de914e58 (diff)
downloadFreeBSD-src-3882f7f0612f5660c6287cfa1ba025f2843a1957.zip
FreeBSD-src-3882f7f0612f5660c6287cfa1ba025f2843a1957.tar.gz
Import patch from https://reviews.freebsd.org/D5186
This is a new approach to fix pfSense ticket #4523. The fix we had in place works but makes the process really slow for big user databases.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/db/hash/hash.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c
index af80929..333b1a1 100644
--- a/lib/libc/db/hash/hash.c
+++ b/lib/libc/db/hash/hash.c
@@ -422,8 +422,10 @@ hdestroy(HTAB *hashp)
if (hashp->tmp_buf)
free(hashp->tmp_buf);
- if (hashp->fp != -1)
+ if (hashp->fp != -1) {
+ (void)_fsync(hashp->fp);
(void)_close(hashp->fp);
+ }
free(hashp);
@@ -458,6 +460,8 @@ hash_sync(const DB *dbp, u_int32_t flags)
return (0);
if (__buf_free(hashp, 0, 1) || flush_meta(hashp))
return (ERROR);
+ if (hashp->fp != -1 && _fsync(hashp->fp) != 0)
+ return (ERROR);
hashp->new_file = 0;
return (0);
}
OpenPOWER on IntegriCloud