mbox series

[0/3] btrfs: some fixes related to the extent map shrinker

Message ID cover.1739710434.git.fdmanana@suse.com (mailing list archive)
Headers show
Series btrfs: some fixes related to the extent map shrinker | expand

Message

Filipe Manana Feb. 16, 2025, 1:16 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

A few fixes and improvements for the extent map shrinker. The first is a
use-after-free that is likely hard to hit and the other two fixes make
things more efficient by avoiding grabbing and dropping (iput) inodes
which don't have extent maps loaded as well as eleminating the need to
do delayed iputs, as that's not needed anymore.

These are related to a recent report from Ivan Shapovalov where the
cleaner kthread was using over 50% of CPU doing a lot of delayed iputs:

  https://lore.kernel.org/linux-btrfs/0414d690ac5680d0d77dfc930606cdc36e42e12f.camel@intelfx.name/

More details in the change logs.

Filipe Manana (3):
  btrfs: fix use-after-free on inode when scanning root during em shrinking
  btrfs: skip inodes without loaded extent maps when shrinking extent maps
  btrfs: do regular iput instead of delayed iput during extent map shrinking

 fs/btrfs/extent_map.c | 82 ++++++++++++++++++++++++++++++-------------
 1 file changed, 58 insertions(+), 24 deletions(-)

Comments

Qu Wenruo Feb. 17, 2025, 9:56 p.m. UTC | #1
在 2025/2/16 23:46, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
>
> A few fixes and improvements for the extent map shrinker. The first is a
> use-after-free that is likely hard to hit and the other two fixes make
> things more efficient by avoiding grabbing and dropping (iput) inodes
> which don't have extent maps loaded as well as eleminating the need to
> do delayed iputs, as that's not needed anymore.
>
> These are related to a recent report from Ivan Shapovalov where the
> cleaner kthread was using over 50% of CPU doing a lot of delayed iputs:
>
>    https://lore.kernel.org/linux-btrfs/0414d690ac5680d0d77dfc930606cdc36e42e12f.camel@intelfx.name/
>
> More details in the change logs.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

>
> Filipe Manana (3):
>    btrfs: fix use-after-free on inode when scanning root during em shrinking
>    btrfs: skip inodes without loaded extent maps when shrinking extent maps
>    btrfs: do regular iput instead of delayed iput during extent map shrinking
>
>   fs/btrfs/extent_map.c | 82 ++++++++++++++++++++++++++++++-------------
>   1 file changed, 58 insertions(+), 24 deletions(-)
>