Continuing the discussion from [0], there are still a number of fsync() 
calls in client programs that are unchecked or where errors are treated 
non-fatally.
Digging around through the call stack, I think changing fsync_fname() to 
just call exit(1) on errors instead of proceeding would address most of 
that.
This affects (at least) initdb, pg_basebackup, pg_checksums, pg_dump, 
pg_dumpall, and pg_rewind.
Thoughts?
[0]: 
https://www.postgresql.org/message-id/flat/9b49fe44-8f3e-eca9-5914-29e9e99030bf%402ndquadrant.com
-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services