Please disable balance auto-resume for 4.9 (or even 4.8)
Automatically resuming an interrupted balance has repeatedly caused all sorts of problems because it creates a possible failure mode when a user can least use it: after a crash/power loss/sudden reboot (which, like it or not, is the de facto "fix random problems" approach for many people).
The idea behind the automnatic resume is good and important for cases like automation and unattended operation, but nevertheless right now it creates more problems than it fixes.
As far as I can see it should be easy enough to simply disable calling btrfs_resume_balance_async() at least on mount (in open_ctree()) and possibly on remount as well. The skip_balance flag could then simply be ignored or removed.
I can't say how much work it would be to completely remove the persistent balance state or whether it is useful to be kept around for resume, but at least not continuing would stop filesystems from eating themselves further on mount.
Holger
Quoted 9 lines · Holger Hoffstätte
Automatically resuming an interrupted balance has repeatedly caused all sorts of problems because it creates a possible failure mode when a user can least use it: after a crash/power loss/sudden reboot (which, like it or not, is the de facto "fix random problems" approach for many people).
The idea behind the automnatic resume is good and important for cases like automation and unattended operation, but nevertheless right now it creates more problems than it fixes.
I would tend to agree.
If the system crashed in the middle of a balance, then we can't assume it was something other than the filesystem being balanced that caused the crash. Resuming a balance in such a situation is risky and could even trigger another crash (yes, I've actually seen this happen, and it was a serious pain to debug). If the balance was paused so the system could reboot with the intent of resuming it later, then the user knows they did this, and should be more than capable of resuming it themself. I've gotten to the point that all of the filesystems I manage have 'skip_balance' in their mount options to avoid all the issues I've had, and because resuming a balance on a filesystem which is mounted on boot can insanely slow down the boot process.
Quoted 10 lines
As far as I can see it should be easy enough to simply disable calling
btrfs_resume_balance_async()at least on mount (inopen_ctree()) and possibly on remount as well. Theskip_balanceflag could then simply be ignored or removed.I can't say how much work it would be to completely remove the persistent balance state or whether it is useful to be kept around for resume, but at least not continuing would stop filesystems from eating themselves further on mount.
I think we should keep the persistent balance state, it has on multiple occasions been useful to me (running a balance, power loss or some other condition requiring shutdown imminent, so I paused, shutdown, and then resumed after reboot), and removing it completely may break some things.
Personally, I think we should add an option to force resuming a balance on mount (resume_balance maybe?), and then switch to skip_balance being default. This would allow people who still want the auto-resume behavior to keep it, while making the defaults safer.