On Thu, Feb 24, 2022 at 02:15:58AM +0000, Naohiro Aota wrote: > On Wed, Feb 23, 2022 at 11:31:07AM +0100, David Sterba wrote: > > On Fri, Feb 18, 2022 at 01:14:19PM +0900, Naohiro Aota wrote: > > [ 2927.114871] BTRFS warning (device vdc: state EX): csum failed root 5 ino 258 off 131072 csum 0x7e797e3e expected csum 0x8941f998 mirror 2 > > [ 2927.115469] btrfs_balance+0x4ed/0x7e0 [btrfs] > > [ 2927.118802] BTRFS warning (device vdc: state EX): csum failed root 5 ino 258 off 139264 csum 0x27df6522 expected csum 0x8941f998 mirror 2 > > [ 2927.119691] ? btrfs_balance+0x7e0/0x7e0 [btrfs] > > [ 2927.123158] BTRFS warning (device vdc: state EX): csum failed root 5 ino 258 off 143360 csum 0x9f144c35 expected csum 0x8941f998 mirror 2 > > [ 2927.123965] balance_kthread+0x37/0x50 [btrfs] > > It looks like this occurs when the balance is resumed. We also need > sb_{start,end}_write around btrfs_balance() in balance_kthred(). Sounds plausible. > I guess we can cause a hang if we resume the balance and freeze the FS > at the same time. The background balance starts only when the filesystem is mounted for write, so right after the sb_rdonly check in open_ctree, but I think you're right that freeze during that can lead to a hang.