xfs: on memory failure, only shut down fs after scanning all mappings
authorDarrick J. Wong <djwong@kernel.org>
Tue, 4 Oct 2022 05:40:01 +0000 (16:40 +1100)
committerDave Chinner <david@fromorbit.com>
Tue, 4 Oct 2022 05:40:01 +0000 (16:40 +1100)
commite033f40be262c4d227f8fbde52856e1d8646872b
tree138bf94d6210591be87f7ec987dc59c5a8c9a779
parentc098576f5f63bc0ee2424bba50892514a71d54e8
xfs: on memory failure, only shut down fs after scanning all mappings

xfs_dax_failure_fn is used to scan the filesystem during a memory
failure event to look for memory mappings to revoke.  Unfortunately,
if it encounters an rmap record for filesystem metadata, it will
shut down the filesystem and the scan immediately.  This means that
we don't complete the mapping revocation scan and instead leave live
mappings to failed memory.  Fix the function to defer the shutdown
until after we've finished culling mappings.

While we're at it, add the usual "xfs_" prefix to struct
failure_info, and actually initialize mf_flags.

Fixes: 6f643c57d57c ("xfs: implement ->notify_failure() for XFS")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_notify_failure.c