Hello All,
Im running Cent OS 5.8 and had a kernal panic.
I have resolved this before by running xfs_repair but recently ran into an issue where it seems to hang on Phase 4.
In research i found there was a pactch for this in the XFS patch list.
I have never applied a patch like this and not sure if anyone is familiar with how.

Patch URL

Downloading the patch it looks like some code to be executed. Any assistance would be great

diff -Nurp xfsprogs-3.1.5/repair/btree.c xfsprogs-3.1.5-dirty/repair/btree.c
--- xfsprogs-3.1.5/repair/btree.c       2011-03-31 12:11:25.000000000 +0900
+++ xfsprogs-3.1.5-dirty/repair/btree.c 2011-04-17 16:04:14.000000000 +0900
@@ -520,6 +520,7 @@ btree_update_key(
                return EINVAL;

        btree_update_node_key(root, root->cursor, 0, new_key);
+       root->cur_key = new_key;

        return 0;
 }

Dani AI

Generated

Quick, practical plan that fills gaps from the replies by and and keeps the production image unchanged.

First, safety checklist before touching the device: always run repairs on an unmounted XFS filesystem (or from rescue media). Use xfs_repair -n to preview changes and only use -L to zero a corrupt log as a last resort — that option discards in‑flight metadata and can cause data loss. Also note that many distributions ship /sbin/fsck.xfs only as an init-script placeholder (it does not perform repairs). (man7.org)

If you cannot change the installed packages, build and run a patched xfs_repair without installing it system‑wide:

  • Clone or download the xfsprogs source, apply the patch with git apply or patch -p1, then build and stage the install into a temporary prefix. Test the staged xfs_repair from rescue media or a VM so the running system is untouched.
  • If you prefer RPMs, rebuild the SRPM into a test RPM (rpmbuild) and install that on a disposable test host or into a chroot. This keeps the main image unchanged and makes rollback easy. (kernel.googlesource.com)

Example (minimal, run on a build host or VM, not on production):

git clone git://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git
cd xfsprogs-dev
# apply your patch: git apply /path/to/patch
autoreconf -fi
./configure --prefix=/usr/local
make -j$(nproc)
make install DESTDIR=/tmp/xfs-staged
# copy /tmp/xfs-staged/usr/local/sbin/xfs_repair to rescue media

If xfs_repair still hangs, create a metadata image with xfs_metadump and run repairs on that copy (or send the metadump and logs to the XFS maintainers for analysis). xfs_metadump is intended for exactly this diagnostic workflow. (man7.org)

Practical notes: test repeatedly on a copied device or metadump, check for underlying I/O or SMART errors before repair, and keep full backups where possible.

Recommended Answers

All 3 Replies

Yes, you'll need to download the source, apply the patch with diffutils (or manually) and then you'll need to recompile it and install it.

You might also try /sbin/fsck.xfs, though I would suspect that it converts that into a call to xfs_repair. It may be worth a try, however.

thank you for the help.
its a custom version of CentOS so we are being told not to patch.
But at least I understand how to now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.