From owner-svn-src-stable@freebsd.org Sun Mar 6 08:40:23 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C10B9DAAAA; Sun, 6 Mar 2016 08:40:23 +0000 (UTC) (envelope-from dwmalone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57C61AEE; Sun, 6 Mar 2016 08:40:23 +0000 (UTC) (envelope-from dwmalone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u268eM5M000720; Sun, 6 Mar 2016 08:40:22 GMT (envelope-from dwmalone@FreeBSD.org) Received: (from dwmalone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u268eMW9000716; Sun, 6 Mar 2016 08:40:22 GMT (envelope-from dwmalone@FreeBSD.org) Message-Id: <201603060840.u268eMW9000716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dwmalone set sender to dwmalone@FreeBSD.org using -f From: David Malone Date: Sun, 6 Mar 2016 08:40:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r296424 - in stable/10: lib/libc/db/hash usr.bin/cap_mkdb usr.sbin/pwd_mkdb usr.sbin/services_mkdb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Mar 2016 08:40:23 -0000 Author: dwmalone Date: Sun Mar 6 08:40:21 2016 New Revision: 296424 URL: https://svnweb.freebsd.org/changeset/base/296424 Log: MFC: r295924: Make sure that hash-based db files fsync befor closing/syncing. r295925: We no longer need O_SYNC pwd_mkd r295465: We no longer need O_SYNC on services_mkdb r295800: We no longer need O_SYNC on cap_mkdb This should improve the performance of building db files. Modified: stable/10/lib/libc/db/hash/hash.c stable/10/usr.bin/cap_mkdb/cap_mkdb.c stable/10/usr.sbin/pwd_mkdb/pwd_mkdb.c stable/10/usr.sbin/services_mkdb/services_mkdb.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/db/hash/hash.c ============================================================================== --- stable/10/lib/libc/db/hash/hash.c Sun Mar 6 04:38:08 2016 (r296423) +++ stable/10/lib/libc/db/hash/hash.c Sun Mar 6 08:40:21 2016 (r296424) @@ -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); } Modified: stable/10/usr.bin/cap_mkdb/cap_mkdb.c ============================================================================== --- stable/10/usr.bin/cap_mkdb/cap_mkdb.c Sun Mar 6 04:38:08 2016 (r296423) +++ stable/10/usr.bin/cap_mkdb/cap_mkdb.c Sun Mar 6 08:40:21 2016 (r296424) @@ -119,7 +119,7 @@ main(int argc, char *argv[]) (void)snprintf(buf, sizeof(buf), "%s.db", capname ? capname : *argv); if ((capname = strdup(buf)) == NULL) errx(1, "strdup failed"); - if ((capdbp = dbopen(capname, O_CREAT | O_TRUNC | O_RDWR | O_SYNC, + if ((capdbp = dbopen(capname, O_CREAT | O_TRUNC | O_RDWR, DEFFILEMODE, DB_HASH, &openinfo)) == NULL) err(1, "%s", buf); Modified: stable/10/usr.sbin/pwd_mkdb/pwd_mkdb.c ============================================================================== --- stable/10/usr.sbin/pwd_mkdb/pwd_mkdb.c Sun Mar 6 04:38:08 2016 (r296423) +++ stable/10/usr.sbin/pwd_mkdb/pwd_mkdb.c Sun Mar 6 08:40:21 2016 (r296424) @@ -225,14 +225,14 @@ main(int argc, char *argv[]) clean = FILE_INSECURE; cp(buf2, buf, PERM_INSECURE); dp = dbopen(buf, - O_RDWR|O_EXCL|O_SYNC, PERM_INSECURE, DB_HASH, &openinfo); + O_RDWR|O_EXCL, PERM_INSECURE, DB_HASH, &openinfo); if (dp == NULL) error(buf); clean = FILE_SECURE; cp(sbuf2, sbuf, PERM_SECURE); sdp = dbopen(sbuf, - O_RDWR|O_EXCL|O_SYNC, PERM_SECURE, DB_HASH, &openinfo); + O_RDWR|O_EXCL, PERM_SECURE, DB_HASH, &openinfo); if (sdp == NULL) error(sbuf); @@ -289,13 +289,13 @@ main(int argc, char *argv[]) method = 0; } else { dp = dbopen(buf, - O_RDWR|O_CREAT|O_EXCL|O_SYNC, PERM_INSECURE, DB_HASH, &openinfo); + O_RDWR|O_CREAT|O_EXCL, PERM_INSECURE, DB_HASH, &openinfo); if (dp == NULL) error(buf); clean = FILE_INSECURE; sdp = dbopen(sbuf, - O_RDWR|O_CREAT|O_EXCL|O_SYNC, PERM_SECURE, DB_HASH, &openinfo); + O_RDWR|O_CREAT|O_EXCL, PERM_SECURE, DB_HASH, &openinfo); if (sdp == NULL) error(sbuf); clean = FILE_SECURE; Modified: stable/10/usr.sbin/services_mkdb/services_mkdb.c ============================================================================== --- stable/10/usr.sbin/services_mkdb/services_mkdb.c Sun Mar 6 04:38:08 2016 (r296423) +++ stable/10/usr.sbin/services_mkdb/services_mkdb.c Sun Mar 6 08:40:21 2016 (r296424) @@ -141,7 +141,7 @@ main(int argc, char *argv[]) err(1, "Cannot install exit handler"); (void)snprintf(tname, sizeof(tname), "%s.tmp", dbname); - db = dbopen(tname, O_RDWR | O_CREAT | O_EXCL | O_SYNC, + db = dbopen(tname, O_RDWR | O_CREAT | O_EXCL, (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH), DB_HASH, &hinfo); if (!db) err(1, "Error opening temporary database `%s'", tname);