xfs: validate logged dquot buffers during recovery

A buffer with a dquot type flag is only ever logged by
xfs_qm_init_dquot_blk(), which initialises and logs the whole buffer in a
single region. So such a buffer has exactly two regions: the format header,
and one data region covering the entire buffer that holds a full chunk of
valid dquots. Online repair also logs whole dquot buffers, but without the
type flag, so they are not checked here.

Validate this in the buffer item validate_item callback. A buffer carrying a
dquot type flag must have that shape, and every dquot in the logged chunk is
verified so a corrupt dquot is never replayed to disk. The dquot content check
in the replay path only looked at the first dquot and relied on the replay loop
for the region bounds, so it is removed and the replay loop reduces to copying
the logged regions into the buffer.

To share the per-dquot verification, xfs_dquot_verify_chunk() is factored out of
xfs_dquot_buf_verify(). It walks a chunk of dquots and, on failure, updates its
dquot pointer to the offending dquot so the caller can report it. The buffer
read verifier is otherwise unchanged.

Assisted-by: LLM
Signed-off-by: Dave Chinner <dgc@kernel.org>
3 files changed