On Mon, Nov 19, 2018 at 10:38:15AM +0100, Johannes Thumshirn wrote:
> btrfs_sysfs_feature_update() was introduced with commit 444e75169872 (btrfs:
> sysfs: introduce helper for syncing bits with sysfs files) to provide a helper
> which was used in 14e46e04958d (btrfs: synchronize incompat feature bits with
> sysfs files).
>
> But commit e410e34fad91 (Revert "btrfs: synchronize incompat feature bits with
> sysfs files") reverted 14e46e04958d so btrfs_sysfs_feature_update() ended up
> as an unused function.
This ends up doing sysfs operations from deep in balance (where we
should be GFP_NOFS) and under heavy balance load, we're making races
against sysfs internals.
Revert it for now while we figure things out.
With the memalloc_nofs_save/memalloc_nofs_restore we can get address the
GFP_NOFS problem, but I don't remember what was the other part about sysfs
internals.
The sysfs bits for features should be match the internal state so this
is a (low priority) bug, I'd prefer fixing it instead of removing the
code.