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
F131656341: D8319.id22331.diff
Fri, Oct 10, 2:32 AM
Unknown Object (File)
Wed, Sep 24, 7:34 PM
Unknown Object (File)
Mon, Sep 22, 5:22 AM
Unknown Object (File)
Fri, Sep 12, 10:04 PM
Unknown Object (File)
Sep 4 2025, 1:37 PM
Unknown Object (File)
Aug 30 2025, 2:33 PM
Unknown Object (File)
Aug 30 2025, 11:12 AM
Unknown Object (File)
Aug 18 2025, 5:53 PM

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.