]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: don't write a corrupt unmount record to force summary counter recalc
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 26 Oct 2022 06:28:38 +0000 (11:58 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 29 Oct 2022 08:20:34 +0000 (10:20 +0200)
commit2f955aaf658172dae22ff36aacb897c8c9d3b59b
treee2c2563a8d776d1d8aa8429adced872e9d4ae38e
parent23c18314d13c40430a0e2da0fda354377264510c
xfs: don't write a corrupt unmount record to force summary counter recalc

commit 6312e563129a43203ceffa4a758819fc14e32a2a upstream.

[ Modify fs/xfs/xfs_log.c to include the changes at locations suitable for
  5.4-lts kernel ]

In commit e9b8320d877b6, I added the ability to force a recalculation of
the filesystem summary counters if they seemed incorrect.  This was done
(not entirely correctly) by tweaking the log code to write an unmount
record without the UMOUNT_TRANS flag set.  At next mount, the log
recovery code will fail to find the unmount record and go into recovery,
which triggers the recalculation.

What actually gets written to the log is what ought to be an unmount
record, but without any flags set to indicate what kind of record it
actually is.  This worked to trigger the recalculation, but we shouldn't
write bogus log records when we could simply write nothing.

Fixes: e9b8320d877b6 ("xfs: force summary counter recalc at next mount")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_log.c