|
|
1569e6 |
From 320cc3b263542e692c4978fb327efa591892ab37 Mon Sep 17 00:00:00 2001
|
|
|
1569e6 |
From: "Darrick J. Wong" <darrick.wong@oracle.com>
|
|
|
1569e6 |
Date: Fri, 10 Jul 2020 15:35:45 -0400
|
|
|
1569e6 |
Subject: [PATCH] xfs_repair: complain about bad interior btree pointers
|
|
|
1569e6 |
|
|
|
1569e6 |
Actually complain about garbage btree node pointers, don't just silently
|
|
|
1569e6 |
ignore them.
|
|
|
1569e6 |
|
|
|
1569e6 |
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
|
|
|
1569e6 |
Reviewed-by: Christoph Hellwig <hch@lst.de>
|
|
|
1569e6 |
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
|
|
|
1569e6 |
---
|
|
|
1569e6 |
libxfs/libxfs_api_defs.h | 1 +
|
|
|
1569e6 |
repair/scan.c | 55 +++++++++++++++++++++++++++++-----------
|
|
|
1569e6 |
2 files changed, 41 insertions(+), 15 deletions(-)
|
|
|
1569e6 |
|
|
|
1569e6 |
Index: xfsprogs-5.0.0/libxfs/libxfs_api_defs.h
|
|
|
1569e6 |
===================================================================
|
|
|
1569e6 |
--- xfsprogs-5.0.0.orig/libxfs/libxfs_api_defs.h
|
|
|
1569e6 |
+++ xfsprogs-5.0.0/libxfs/libxfs_api_defs.h
|
|
|
1569e6 |
@@ -118,6 +118,7 @@
|
|
|
1569e6 |
#define xfs_symlink_blocks libxfs_symlink_blocks
|
|
|
1569e6 |
#define xfs_symlink_hdr_ok libxfs_symlink_hdr_ok
|
|
|
1569e6 |
|
|
|
1569e6 |
+#define xfs_verify_agbno libxfs_verify_agbno
|
|
|
1569e6 |
#define xfs_verify_cksum libxfs_verify_cksum
|
|
|
1569e6 |
#define xfs_dinode_verify libxfs_dinode_verify
|
|
|
1569e6 |
|
|
|
1569e6 |
Index: xfsprogs-5.0.0/repair/scan.c
|
|
|
1569e6 |
===================================================================
|
|
|
1569e6 |
--- xfsprogs-5.0.0.orig/repair/scan.c
|
|
|
1569e6 |
+++ xfsprogs-5.0.0/repair/scan.c
|
|
|
1569e6 |
@@ -743,6 +743,14 @@ _("%s freespace btree block claimed (sta
|
|
|
1569e6 |
for (i = 0; i < numrecs; i++) {
|
|
|
1569e6 |
xfs_agblock_t agbno = be32_to_cpu(pp[i]);
|
|
|
1569e6 |
|
|
|
1569e6 |
+ if (!libxfs_verify_agbno(mp, agno, agbno)) {
|
|
|
1569e6 |
+ do_warn(
|
|
|
1569e6 |
+ _("bad btree pointer (%u) in %sbt block %u/%u\n"),
|
|
|
1569e6 |
+ agbno, name, agno, bno);
|
|
|
1569e6 |
+ suspect++;
|
|
|
1569e6 |
+ return;
|
|
|
1569e6 |
+ }
|
|
|
1569e6 |
+
|
|
|
1569e6 |
/*
|
|
|
1569e6 |
* XXX - put sibling detection right here.
|
|
|
1569e6 |
* we know our sibling chain is good. So as we go,
|
|
|
1569e6 |
@@ -752,10 +760,8 @@ _("%s freespace btree block claimed (sta
|
|
|
1569e6 |
* pointer mismatch, try and extract as much data
|
|
|
1569e6 |
* as possible.
|
|
|
1569e6 |
*/
|
|
|
1569e6 |
- if (agbno != 0 && verify_agbno(mp, agno, agbno)) {
|
|
|
1569e6 |
- scan_sbtree(agbno, level, agno, suspect, scan_allocbt,
|
|
|
1569e6 |
- 0, magic, priv, ops);
|
|
|
1569e6 |
- }
|
|
|
1569e6 |
+ scan_sbtree(agbno, level, agno, suspect, scan_allocbt, 0,
|
|
|
1569e6 |
+ magic, priv, ops);
|
|
|
1569e6 |
}
|
|
|
1569e6 |
}
|
|
|
1569e6 |
|
|
|
1569e6 |
@@ -1196,10 +1202,16 @@ advance:
|
|
|
1569e6 |
continue;
|
|
|
1569e6 |
}
|
|
|
1569e6 |
|
|
|
1569e6 |
- if (agbno != 0 && verify_agbno(mp, agno, agbno)) {
|
|
|
1569e6 |
- scan_sbtree(agbno, level, agno, suspect, scan_rmapbt, 0,
|
|
|
1569e6 |
- magic, priv, ops);
|
|
|
1569e6 |
+ if (!libxfs_verify_agbno(mp, agno, agbno)) {
|
|
|
1569e6 |
+ do_warn(
|
|
|
1569e6 |
+ _("bad btree pointer (%u) in %sbt block %u/%u\n"),
|
|
|
1569e6 |
+ agbno, name, agno, bno);
|
|
|
1569e6 |
+ suspect++;
|
|
|
1569e6 |
+ return;
|
|
|
1569e6 |
}
|
|
|
1569e6 |
+
|
|
|
1569e6 |
+ scan_sbtree(agbno, level, agno, suspect, scan_rmapbt, 0, magic,
|
|
|
1569e6 |
+ priv, ops);
|
|
|
1569e6 |
}
|
|
|
1569e6 |
|
|
|
1569e6 |
out:
|
|
|
1569e6 |
@@ -1416,10 +1428,16 @@ _("extent (%u/%u) len %u claimed, state
|
|
|
1569e6 |
for (i = 0; i < numrecs; i++) {
|
|
|
1569e6 |
xfs_agblock_t agbno = be32_to_cpu(pp[i]);
|
|
|
1569e6 |
|
|
|
1569e6 |
- if (agbno != 0 && verify_agbno(mp, agno, agbno)) {
|
|
|
1569e6 |
- scan_sbtree(agbno, level, agno, suspect, scan_refcbt, 0,
|
|
|
1569e6 |
- magic, priv, ops);
|
|
|
1569e6 |
+ if (!libxfs_verify_agbno(mp, agno, agbno)) {
|
|
|
1569e6 |
+ do_warn(
|
|
|
1569e6 |
+ _("bad btree pointer (%u) in %sbt block %u/%u\n"),
|
|
|
1569e6 |
+ agbno, name, agno, bno);
|
|
|
1569e6 |
+ suspect++;
|
|
|
1569e6 |
+ return;
|
|
|
1569e6 |
}
|
|
|
1569e6 |
+
|
|
|
1569e6 |
+ scan_sbtree(agbno, level, agno, suspect, scan_refcbt, 0, magic,
|
|
|
1569e6 |
+ priv, ops);
|
|
|
1569e6 |
}
|
|
|
1569e6 |
out:
|
|
|
1569e6 |
if (suspect)
|
|
|
1569e6 |
@@ -2083,11 +2101,18 @@ _("inode btree block claimed (state %d),
|
|
|
1569e6 |
}
|
|
|
1569e6 |
|
|
|
1569e6 |
for (i = 0; i < numrecs; i++) {
|
|
|
1569e6 |
- if (be32_to_cpu(pp[i]) != 0 && verify_agbno(mp, agno,
|
|
|
1569e6 |
- be32_to_cpu(pp[i])))
|
|
|
1569e6 |
- scan_sbtree(be32_to_cpu(pp[i]), level, agno,
|
|
|
1569e6 |
- suspect, scan_inobt, 0, magic, priv,
|
|
|
1569e6 |
- ops);
|
|
|
1569e6 |
+ xfs_agblock_t agbno = be32_to_cpu(pp[i]);
|
|
|
1569e6 |
+
|
|
|
1569e6 |
+ if (!libxfs_verify_agbno(mp, agno, agbno)) {
|
|
|
1569e6 |
+ do_warn(
|
|
|
1569e6 |
+ _("bad btree pointer (%u) in %sbt block %u/%u\n"),
|
|
|
1569e6 |
+ agbno, name, agno, bno);
|
|
|
1569e6 |
+ suspect++;
|
|
|
1569e6 |
+ return;
|
|
|
1569e6 |
+ }
|
|
|
1569e6 |
+
|
|
|
1569e6 |
+ scan_sbtree(be32_to_cpu(pp[i]), level, agno, suspect,
|
|
|
1569e6 |
+ scan_inobt, 0, magic, priv, ops);
|
|
|
1569e6 |
}
|
|
|
1569e6 |
}
|
|
|
1569e6 |
|