• A
    xfs: Wrapped journal record corruption on read at recovery · fc5bc4c8
    Andy Poling 提交于
    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").
    Signed-off-by: NAndy Poling <andy@realbig.com>
    Reviewed-by: NAlex Elder <aelder@sgi.com>
    Signed-off-by: NAlex Elder <aelder@sgi.com>
    fc5bc4c8
xfs_log_recover.c 107.9 KB