Skip to content

Commit 7880b1f

Browse files
Darrick J. Wonggregkh
authored andcommitted
xfs: dquot recovery does not validate the recovered dquot
[ Upstream commit 9c235dfc3d3f901fe22acb20f2ab37ff39f2ce02 ] When we're recovering ondisk quota records from the log, we need to validate the recovered buffer contents before writing them to disk. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Chandan Babu R <[email protected]> Signed-off-by: Leah Rumancik <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent df71641 commit 7880b1f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

fs/xfs/xfs_dquot_item_recover.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "xfs_log.h"
2020
#include "xfs_log_priv.h"
2121
#include "xfs_log_recover.h"
22+
#include "xfs_error.h"
2223

2324
STATIC void
2425
xlog_recover_dquot_ra_pass2(
@@ -152,6 +153,19 @@ xlog_recover_dquot_commit_pass2(
152153
XFS_DQUOT_CRC_OFF);
153154
}
154155

156+
/* Validate the recovered dquot. */
157+
fa = xfs_dqblk_verify(log->l_mp, dqb, dq_f->qlf_id);
158+
if (fa) {
159+
XFS_CORRUPTION_ERROR("Bad dquot after recovery",
160+
XFS_ERRLEVEL_LOW, mp, dqb,
161+
sizeof(struct xfs_dqblk));
162+
xfs_alert(mp,
163+
"Metadata corruption detected at %pS, dquot 0x%x",
164+
fa, dq_f->qlf_id);
165+
error = -EFSCORRUPTED;
166+
goto out_release;
167+
}
168+
155169
ASSERT(dq_f->qlf_size == 2);
156170
ASSERT(bp->b_mount == mp);
157171
bp->b_flags |= _XBF_LOGRECOVERY;

0 commit comments

Comments
 (0)