summaryrefslogtreecommitdiffstats
path: root/lib/libc/db
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2016-04-06 22:38:50 +0000
committerbdrewery <bdrewery@FreeBSD.org>2016-04-06 22:38:50 +0000
commit3261994ba6feb27f89151ec6f7139edd8484cf00 (patch)
tree7910e83b0323d45afcba2659ea75d9964895c04f /lib/libc/db
parent5499ecc9666fdf02ad318ae02374b358ee18ff35 (diff)
downloadFreeBSD-src-3261994ba6feb27f89151ec6f7139edd8484cf00.zip
FreeBSD-src-3261994ba6feb27f89151ec6f7139edd8484cf00.tar.gz
Follow-up r295924: Only sync hash-based db files open for writing when closing.
This fixes a major performance regression when reading db files such as the pw database during a 'pkg install'. MFC after: 1 week Tested by: bapt Reviewed by: bapt Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D5868
Diffstat (limited to 'lib/libc/db')
-rw-r--r--lib/libc/db/hash/hash.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c
index 02503ee..fc4e50e 100644
--- a/lib/libc/db/hash/hash.c
+++ b/lib/libc/db/hash/hash.c
@@ -423,7 +423,8 @@ hdestroy(HTAB *hashp)
free(hashp->tmp_buf);
if (hashp->fp != -1) {
- (void)_fsync(hashp->fp);
+ if (hashp->save_file)
+ (void)_fsync(hashp->fp);
(void)_close(hashp->fp);
}
OpenPOWER on IntegriCloud