openafs/doc/man-pages/pod8
Andrew Deason 4498bd8179 volser: Don't NUL-pad failed pread()s in dumps
Currently, the volserver SAFSVolDump RPC and the 'voldump' utility
handle short reads from pread() for vnode payloads by padding the
missing data with NUL bytes. That is, if we request 4k of data for our
pread() call, and we only get back 1k of data, we'll write 1k of data
to the volume dump stream followed by 3k of NUL bytes, and log
messages like this:

    1 Volser: DumpFile: Error reading inode 1234 for vnode 5678
    1 Volser: DumpFile: Null padding file: 3072 bytes at offset 40960

This can happen if we hit EOF on the underlying file sooner than
expected, or if the OS just responds with fewer bytes than requested
for any reason.

The same code path tries to do the same NUL-padding if pread() returns
an error (for example, EIO), padding the entire e.g. 4k block with
NULs. However, in this case, the "padding" code often doesn't work as
intended, because we compare 'n' (set to -1) with 'howMany' (set to 4k
in this example), like so:

    if (n < howMany)

Here, 'n' is signed (ssize_t), and 'howMany' is unsigned (size_t), and
so compilers will promote 'n' to the unsigned type, causing this
conditional to fail when n is -1. As a result, all of the relevant log
messages are skipped, and the data in the dumpstream gets corrupted
(we skip a block of data, and our 'howFar' offset goes back by 1). So
this can result in rare silent data corruption in volume dumps, which
can occur during volume releases, moves, etc.

To fix all of this, remove this bizarre NUL-padding behavior in the
volserver. Instead:

- For actual errors from pread(), return an error, like we do for I/O
  errors in most other code paths.

- For short reads, just write out the amount of data we actually read,
  and keep going.

- For premature EOF, treat it like a pread() error, but log a slightly
  different message.

For the 'voldump' utility, the padding behavior can make sense if a
user is trying to recover volume data offline in a disaster recovery
scenario. So for voldump, add a new switch (-pad-errors) to enable the
padding behavior, but change the default behavior to bail out on
errors.

Change-Id: Ibd6e76c5ea0dea95e3354d9b34536296f81b4f67
Reviewed-on: https://gerrit.openafs.org/14255
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2020-07-24 12:03:44 -04:00
..
fragments viced: add opt to allow admin writes on RO servers 2019-12-05 23:10:48 -05:00
.gitignore document dasalvager 2010-07-18 09:46:48 -07:00
afsd.pod doc: Edits to the 'afsd -volume-ttl' manpage 2018-02-15 22:16:00 -05:00
akeyconvert.pod Add akeyconvert, for rxkad.keytab to KeyFileExt conversion 2016-04-28 19:24:09 -04:00
aklog_dynamic_auth.pod doc: Add aklog_dynamic_auth manpage 2011-05-15 06:15:43 -07:00
asetkey.pod asetkey: add 'add-random' command 2019-04-19 17:06:41 -04:00
backup_adddump.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
backup_addhost.pod doc: replace hostnames with IETF example hostnames 2012-02-17 20:51:58 -08:00
backup_addvolentry.pod doc: quote list items in POD 2013-05-01 13:58:56 -07:00
backup_addvolset.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
backup_apropos.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
backup_dbverify.pod doc: replace hostnames with IETF example hostnames 2012-02-17 20:51:58 -08:00
backup_deldump.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
backup_deletedump.pod doc: backup manpage fix 2015-02-03 13:50:32 -05:00
backup_delhost.pod doc: replace hostnames with IETF example hostnames 2012-02-17 20:51:58 -08:00
backup_delvolentry.pod Update backup suite manpages 2009-10-08 15:40:35 -07:00
backup_delvolset.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
backup_diskrestore.pod doc: backup manpage fixes 2013-11-07 04:21:42 -08:00
backup_dump.pod doc: backup manpage fixes 2013-11-07 04:21:42 -08:00
backup_dumpinfo.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
backup_help.pod Update backup suite manpages 2009-10-08 15:40:35 -07:00
backup_interactive.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
backup_jobs.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
backup_kill.pod doc: fix some broken link specifications 2011-06-22 11:01:09 -07:00
backup_labeltape.pod doc: fix some broken link specifications 2011-06-22 11:01:09 -07:00
backup_listdumps.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
backup_listhosts.pod doc: replace hostnames with IETF example hostnames 2012-02-17 20:51:58 -08:00
backup_listvolsets.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
backup_quit.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
backup_readlabel.pod doc: replace hostnames with IETF example hostnames 2012-02-17 20:51:58 -08:00
backup_restoredb.pod Remove references to IBM AFS 2010-05-26 12:05:45 -07:00
backup_savedb.pod Update backup suite manpages 2009-10-08 15:40:35 -07:00
backup_scantape.pod doc: replace hostnames with IETF example hostnames 2012-02-17 20:51:58 -08:00
backup_setexp.pod Update backup suite manpages 2009-10-08 15:40:35 -07:00
backup_status.pod Update backup suite manpages 2009-10-08 15:40:35 -07:00
backup_volinfo.pod Update backup suite manpages 2009-10-08 15:40:35 -07:00
backup_volrestore.pod doc: backup manpage fixes 2013-11-07 04:21:42 -08:00
backup_volsetrestore.pod doc: backup manpage fixes 2013-11-07 04:21:42 -08:00
backup.pod OPENAFS-SA-2018-001 backup: use authenticated connection to butc 2018-09-10 22:45:22 -05:00
bos_addhost.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_addkey.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_adduser.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_apropos.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
bos_create.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_delete.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_exec.pod doc: replace hostnames with IETF example hostnames 2012-02-17 20:51:58 -08:00
bos_getdate.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_getlog.pod doc: add the PtLog man page 2016-12-22 17:21:50 -05:00
bos_getrestart.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_getrestricted.pod doc: improve man pages related to bos restricted mode 2014-03-11 06:26:42 -07:00
bos_help.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
bos_install.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_listhosts.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_listkeys.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_listusers.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_prune.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_removehost.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_removekey.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_removeuser.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_restart.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_salvage.pod doc: the last partition name is /vicepiu 2018-09-14 08:35:26 -04:00
bos_setauth.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_setcellname.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_setrestart.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_setrestricted.pod doc: bos setrestricted -mode 0 does make sense 2014-03-26 14:00:35 -07:00
bos_shutdown.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_start.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_startup.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_status.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_stop.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_uninstall.pod Document KeyFileExt(5) 2015-08-27 22:31:44 -04:00
bos_util.pod spelling/grammar fixes for manpages 2011-02-03 12:29:34 -08:00
bos.pod doc: document the version subcommand 2015-11-12 11:29:37 -05:00
bosserver.pod externalize log rotation 2016-04-26 19:34:59 -04:00
buserver.pod doc: buserver manpage fixes 2013-11-04 03:55:54 -08:00
butc.pod OPENAFS-SA-2018-001 butc: require authenticated connections with -localauth 2018-09-09 17:35:29 -05:00
dafileserver.pod.in viced: make -vhashsize usable for non-DAFS 2016-07-05 19:04:33 -04:00
dasalvager.pod.in document dasalvager 2010-07-18 09:46:48 -07:00
davolserver.pod.in doc: replace hostnames with IETF example hostnames 2012-02-17 20:51:58 -08:00
fileserver.pod.in doc: replace hostnames with IETF example hostnames 2012-02-17 20:51:58 -08:00
fms.pod Remove references to IBM AFS 2010-05-26 12:05:45 -07:00
fssync-debug_attach.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_callback.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_detach.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_error.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_header.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_leaveoff.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_list.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_mode.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_move.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_offline.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_online.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_query.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_stats.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_vgcadd.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_vgcdel.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_vgcquery.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_vgcscan.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_vgcscanall.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_vnode.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug_volop.pod doc: Add -help option to fssync-debug manpages 2013-11-04 04:07:38 -08:00
fssync-debug.pod Link dafssync-debug(8) to fssync-debug(8) 2010-09-23 02:22:44 -07:00
fstrace_apropos.pod Update fstrace suite manpages 2009-10-08 15:28:56 -07:00
fstrace_clear.pod Update fstrace suite manpages 2009-10-08 15:28:56 -07:00
fstrace_dump.pod Update fstrace suite manpages 2009-10-08 15:28:56 -07:00
fstrace_help.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
fstrace_lslog.pod Update fstrace suite manpages 2009-10-08 15:28:56 -07:00
fstrace_lsset.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
fstrace_setlog.pod Update fstrace suite manpages 2009-10-08 15:28:56 -07:00
fstrace_setset.pod Update fstrace suite manpages 2009-10-08 15:28:56 -07:00
fstrace.pod Remove references to IBM AFS 2010-05-26 12:05:45 -07:00
ka-forwarder.pod doc: fix typo on ka-forwarder man page 2014-03-06 12:52:30 -08:00
kadb_check.pod doc: fix some broken link specifications 2011-06-22 11:01:09 -07:00
kas_apropos.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
kas_create.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
kas_delete.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
kas_examine.pod spelling/grammar fixes for manpages 2011-02-03 12:29:34 -08:00
kas_forgetticket.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
kas_help.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
kas_interactive.pod doc: replace hostnames with IETF example hostnames 2012-02-17 20:51:58 -08:00
kas_list.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
kas_listtickets.pod doc: replace hostnames with IETF example hostnames 2012-02-17 20:51:58 -08:00
kas_noauthentication.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
kas_quit.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
kas_setfields.pod spelling/grammar fixes for manpages 2011-02-03 12:29:34 -08:00
kas_setpassword.pod Remove references to IBM AFS 2010-05-26 12:05:45 -07:00
kas_statistics.pod doc: replace hostnames with IETF example hostnames 2012-02-17 20:51:58 -08:00
kas_stringtokey.pod doc: replace hostnames with IETF example hostnames 2012-02-17 20:51:58 -08:00
kas_unlock.pod man-page-name-underscore-20071111 2007-11-11 22:54:56 +00:00
kas.pod doc: document the version subcommand 2015-11-12 11:29:37 -05:00
kaserver.pod doc: kaserver manpage fixes 2013-11-04 04:04:04 -08:00
kdb.pod doc: kdb manpage fixes 2013-11-04 11:58:10 -08:00
kpwvalid.pod doc: fix some broken link specifications 2011-06-22 11:01:09 -07:00
prdb_check.pod doc: fix some broken link specifications 2011-06-22 11:01:09 -07:00
pt_util.pod doc: remove supergroup caution from pt_util 2015-09-13 03:16:45 -04:00
ptserver.pod doc: Document new rxgk options 2020-01-08 00:15:42 -05:00
read_tape.pod Move restorevol to bin from sbin 2009-09-09 21:22:34 -07:00
rmtsysd.pod man-page-rmtsysd-20090518 2009-05-18 21:22:04 +00:00
salvager.pod.in document dasalvager 2010-07-18 09:46:48 -07:00
salvageserver.pod dafs: remove the salvageserver -showlog option 2015-12-02 23:52:07 -05:00
state_analyzer.pod Minor state_analyzer manpage corrections 2010-03-29 08:04:42 -07:00
upclient.pod doc: replace hostnames with IETF example hostnames 2012-02-17 20:51:58 -08:00
upserver.pod doc: upserver manpage fixes 2013-11-04 09:34:08 -08:00
uss_add.pod doc: the last partition name is /vicepiu 2018-09-14 08:35:26 -04:00
uss_apropos.pod More deprecations noted. 2010-11-27 22:40:07 -08:00
uss_bulk.pod More deprecations noted. 2010-11-27 22:40:07 -08:00
uss_delete.pod doc: replace hostnames with IETF example hostnames 2012-02-17 20:51:58 -08:00
uss_help.pod More deprecations noted. 2010-11-27 22:40:07 -08:00
uss.pod More deprecations noted. 2010-11-27 22:40:07 -08:00
vldb_check.pod doc: vldb_check manpage fixes 2013-11-04 09:34:19 -08:00
vldb_convert.pod doc: vldb_check manpage fixes 2013-11-04 09:34:19 -08:00
vlserver.pod doc: Document new rxgk options 2020-01-08 00:15:42 -05:00
voldump.pod volser: Don't NUL-pad failed pread()s in dumps 2020-07-24 12:03:44 -04:00
volinfo.pod doc: volscan man page 2014-03-25 09:59:10 -07:00
volscan.pod volscan: fix copyright and licence notice 2014-08-13 12:06:38 -04:00
volserver.pod.in doc: replace hostnames with IETF example hostnames 2012-02-17 20:51:58 -08:00
vsys.pod man-page-vsys-20090518 2009-05-18 21:28:26 +00:00
xfs_size_check.pod pretty-html-synopsis-20060228 2006-03-01 05:02:29 +00:00