xfs
[Top] [All Lists]

Wrapped journal record corruption on read at recovery - patch attached (

To: xfs@xxxxxxxxxxx
Subject: Wrapped journal record corruption on read at recovery - patch attached (was Re: XFS corruption with failover)
From: Andy Poling <andy@xxxxxxxxxxx>
Date: Tue, 13 Oct 2009 14:26:23 -0500 (CDT)
Cc: John Quigley <jquigley@xxxxxxxxxxxxxx>
In-reply-to: <mailman.0.1255458988.141519.xfs@xxxxxxxxxxx>
References: <mailman.0.1255458988.141519.xfs@xxxxxxxxxxx>
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
At his request, I followed up on John Quigley's problem, and I believe I found
a bug in xlog_do_recovery_pass() in handling of a wrapped journal record.  A
patch against 2.6.28.10 is attached.  It looks like the patch will apply
cleanly against any recent version.

Summary of problem:

If a journal record wraps at the physical end of the journal, it has to be
read in two parts in xlog_do_recovery_pass(): a read at the physical end and a
read at the physical beginning.  If xlog_bread() has to re-align the first
read, the second read request does not take that re-alignment into account.
If the first read was re-aligned, the second read over-writes the end of the
data from the first read, effectively corrupting it.  This can happen either
when reading the record header or reading the record data.

The first sanity check in xlog_recover_process_data() is to check for a valid
clientid, so that is the error reported.


Summary of fix:

If there was a first read at the physical end, XFS_BUF_PTR() returns where the
data was requested to begin.  Conversely, because it is the result of
xlog_align(), offset indicates where the requested data for the first read
actually begins - whether or not xlog_bread() has re-aligned it.

Using offset as the base for the calculation of where to place the second read
data ensures that it will be correctly placed immediately following the data
from the first read instead of sometimes over-writing the end of it.

The attached patch has resolved the reported problem of occasional inability
to recover the journal (reporting "bad clientid").

-Andy

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so. - Mark Twain

Attachment: xfs_log_recover.pat
Description: xfs_log_recover.pat

<Prev in Thread] Current Thread [Next in Thread>