xfs: bulkstat error handling is broken
authorDave Chinner <dchinner@redhat.com>
Thu, 6 Nov 2014 21:31:15 +0000 (08:31 +1100)
committerDave Chinner <david@fromorbit.com>
Thu, 6 Nov 2014 21:31:15 +0000 (08:31 +1100)
commitfebe3cbe38b0bc0a925906dc90e8d59048851f87
tree34a2cca7bbb1c14f19032eb9cfa693f5a3146b4a
parent6e57c542cb7e0e580eb53ae76a77875c7d92b4b1
xfs: bulkstat error handling is broken

The error propagation is a horror - xfs_bulkstat() returns
a rval variable which is only set if there are formatter errors. Any
sort of btree walk error or corruption will cause the bulkstat walk
to terminate but will not pass an error back to userspace. Worse
is the fact that formatter errors will also be ignored if any inodes
were correctly formatted into the user buffer.

Hence bulkstat can fail badly yet still report success to userspace.
This causes significant issues with xfsdump not dumping everything
in the filesystem yet reporting success. It's not until a restore
fails that there is any indication that the dump was bad and tha
bulkstat failed. This patch now triggers xfsdump to fail with
bulkstat errors rather than silently missing files in the dump.

This now causes bulkstat to fail when the lastino cookie does not
fall inside an existing inode chunk. The pre-3.17 code tolerated
that error by allowing the code to move to the next inode chunk
as the agino target is guaranteed to fall into the next btree
record.

With the fixes up to this point in the series, xfsdump now passes on
the troublesome filesystem image that exposes all these bugs.

cc: <stable@vger.kernel.org>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
fs/xfs/xfs_itable.c