OSDN Git Service

xfs: check directory bestfree information in the verifier
authorDarrick J. Wong <darrick.wong@oracle.com>
Sun, 3 Jun 2018 23:10:13 +0000 (16:10 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Tue, 5 Jun 2018 01:25:04 +0000 (18:25 -0700)
commite4f45eff86fdbafd8e0ba072fd52422e32e5b5ac
tree1377fb33c226a3c230e1f51e638fcf6edb8c089c
parent924cade4df49e7c9fddcbae678dbd9dee3b0aeb6
xfs: check directory bestfree information in the verifier

Create a variant of xfs_dir2_data_freefind that is suitable for use in a
verifier.  Because _freefind is called by the verifier, we simply
duplicate the _freefind function, convert the ASSERTs to return
__this_address, and modify the verifier to call our new function.  Once
we've made it impossible for directory blocks with bad bestfree data to
make it into the filesystem we can remove the DEBUG code from the
regular _freefind function.

Underlying argument: corruption of on-disk metadata should return
-EFSCORRUPTED instead of blowing ASSERTs.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/libxfs/xfs_dir2_data.c