On Mon, Oct 31, 2022 at 11:08:33AM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > Currently, the only way to lock an allocation group is to hold the AGI > and AGF buffers. If a repair needs to roll the transaction while > repairing some AG metadata, it maintains that lock by holding the two > buffers across the transaction roll and joins them afterwards. > > However, repair is not like other parts of XFS that employ the bhold - > roll - bjoin sequence because it's possible that the AGI or AGF buffers > are not actually dirty before the roll. This presents two problems -- > First, we need to redirty those buffers to keep them moving along in the > log to avoid pinning the log tail. Second, a clean buffer log item can > detach from the buffer. If this happens, the buffer type state is > discarded along with the bli and must be reattached before the next time > the buffer is logged. If it is not, the logging code will complain and > log recovery will not work properly. > > An earlier version of this patch tried to fix the second problem by > re-setting the buffer type in the bli after joining the buffer to the > new transaction, but that looked weird and didn't solve the first > problem. Instead, solve both problems by logging the buffer before > rolling the transaction. > > Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> I guess this is fine as long as it is confined to the scrub code; if we need to hold clean buffers across transaction rolls in other code we really need to sort out the BLI life cycle issues that this currently exposes. Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx> -- Dave Chinner david@xxxxxxxxxxxxx