Page MenuHomeFreeBSD

Speed up pw operations that edit /etc/group or /etc/passwd
ClosedPublic

Authored by asomers on Oct 21 2016, 8:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jul 5, 8:52 AM
Unknown Object (File)
Sat, Jul 4, 4:38 AM
Unknown Object (File)
Fri, Jul 3, 7:47 AM
Unknown Object (File)
Wed, Jul 1, 6:46 AM
Unknown Object (File)
Mon, Jun 29, 11:07 PM
Unknown Object (File)
Jun 16 2026, 2:30 AM
Unknown Object (File)
Jun 5 2026, 7:44 PM
Unknown Object (File)
Jun 3 2026, 3:02 AM

Details

Summary

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 place fsync()s instead, which is much faster. Using a
ZFS tmpdir, the time to run pw's kyua tests drops from 245s to 35s.

Test Plan

pw's kyua tests

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

asomers retitled this revision from to Speed up pw operations that edit /etc/group or /etc/passwd.
asomers updated this object.
asomers edited the test plan for this revision. (Show Details)
asomers added reviewers: garga, dwmalone.
asomers added subscribers: truckman, bapt, vangyzen, se.
This revision is now accepted and ready to land.Oct 21 2016, 8:39 PM

Is anybody able to test the pfsense issue with my patch?
https://redmine.pfsense.org/issues/4523

bapt added a reviewer: bapt.
garga edited edge metadata.

I tried to break it on pfSense and couldn't reproduce original issue. Looks OK to me

This revision was automatically updated to reflect the committed changes.