7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Darrick J. Wong commit f98d007017acf0eaec2e116ff9c0ece735f61bb3 upstream. LOLLM observed that if either fdblocks or frextents are negative, we'll set the CORRUPT flag and exit immediately. This doesn't work for a repair because we still have to walk the filesystem metadata to compute the correct summary counters so that we can install the new values. Currently we just write zeroes into the summary counters, which isn't right. Cc: stable@vger.kernel.org # v6.9 Fixes: 4ed080cd7cb077 ("xfs: repair summary counters") Signed-off-by: Darrick J. Wong Assisted-by: LOLLM # finding obvious bugs Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Signed-off-by: Greg Kroah-Hartman --- fs/xfs/scrub/fscounters.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/fs/xfs/scrub/fscounters.c +++ b/fs/xfs/scrub/fscounters.c @@ -541,7 +541,10 @@ xchk_fscounters( return -EDEADLOCK; xchk_set_corrupt(sc); - return 0; + + /* Need to compute all the fields in fsc for a repair */ + if (!xchk_could_repair(sc)) + return 0; } /* See if icount is obviously wrong. */