]> git.cameronkatri.com Git - pw-darwin.git/commit
Speed up pw operations that edit /etc/group or /etc/passwd
authorAlan Somers <asomers@FreeBSD.org>
Fri, 18 Nov 2016 16:07:08 +0000 (16:07 +0000)
committerAlan Somers <asomers@FreeBSD.org>
Fri, 18 Nov 2016 16:07:08 +0000 (16:07 +0000)
commitb442f00957395ba59112d4d0e0eb4f71708d811b
treebe77a1acfdc292061fba5f25273bf8c69b7d4e14
parenteaf8d4a9d903595d2f3a388ed56fd20b34d9f80b
Speed up pw operations that edit /etc/group or /etc/passwd

r285050 fixed a bug in pw that could lead to /etc/passwd or /etc/group
corruption on power loss. However, it fixed it by opening those files with
O_SYNC, which is very slow, especially on ZFS. This change replaces O_SYNC
with appropriately placed fsync()s instead, which is much faster. Using a
ZFS tmpdir, the time to run pw's kyua tests drops from 245s to 35s.

Reviewed by: allanjude, bapt, vangyzen, garga
Tested on pfSense by: garga
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D8319
libutil/gr_util.c
libutil/pw_util.c
pw/grupd.c
pw/pw_nis.c
pw/pwupd.c