aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/db
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2016-04-06 22:38:50 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2016-04-06 22:38:50 +0000
commit15719ec49938e1f7b3feb7a4df3c1862eeb4829a (patch)
tree7910e83b0323d45afcba2659ea75d9964895c04f /lib/libc/db
parent9af130ae8c039e10912f13b58b5cb97362d00e72 (diff)
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
Notes
svn path=/head/; revision=297626
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 02503ee1b558..fc4e50eb0b25 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);
}