mbox series

[0/3] btrfs: fix a rare deadlock case when logging inodes

Message ID cover.1669025204.git.fdmanana@suse.com (mailing list archive)
Headers show
Series btrfs: fix a rare deadlock case when logging inodes | expand

Message

Filipe Manana Nov. 21, 2022, 10:23 a.m. UTC
From: Filipe Manana <fdmanana@suse.com>

Syzbot recently reported a lockdep splat about a potential deadlock case.
It should be a rare case, but it is indeed possible to happen. The first
patch in the series fixes that deadlock, the second one unifies back two
functions that used to be the same, and finally the last one removes some
outdated logic and adds an assertion (and documentation) to make sure we
don't forget about that type of deadlock in case overwrite_item() gets
used in the future for updating items in a log tree. More details in the
changelogs of each patch.

Filipe Manana (3):
  btrfs: do not modify log tree while holding a leaf from fs tree locked
  btrfs: unify overwrite_item() and do_overwrite_item()
  btrfs: remove outdated logic from overwrite_item() and add assertion

 fs/btrfs/tree-log.c | 149 ++++++++++++++++++++++++++------------------
 1 file changed, 88 insertions(+), 61 deletions(-)

Comments

Josef Bacik Nov. 21, 2022, 4:12 p.m. UTC | #1
On Mon, Nov 21, 2022 at 10:23:21AM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Syzbot recently reported a lockdep splat about a potential deadlock case.
> It should be a rare case, but it is indeed possible to happen. The first
> patch in the series fixes that deadlock, the second one unifies back two
> functions that used to be the same, and finally the last one removes some
> outdated logic and adds an assertion (and documentation) to make sure we
> don't forget about that type of deadlock in case overwrite_item() gets
> used in the future for updating items in a log tree. More details in the
> changelogs of each patch.
> 
> Filipe Manana (3):
>   btrfs: do not modify log tree while holding a leaf from fs tree locked
>   btrfs: unify overwrite_item() and do_overwrite_item()
>   btrfs: remove outdated logic from overwrite_item() and add assertion
> 
>  fs/btrfs/tree-log.c | 149 ++++++++++++++++++++++++++------------------
>  1 file changed, 88 insertions(+), 61 deletions(-)
>

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef
David Sterba Nov. 21, 2022, 7:23 p.m. UTC | #2
On Mon, Nov 21, 2022 at 10:23:21AM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Syzbot recently reported a lockdep splat about a potential deadlock case.
> It should be a rare case, but it is indeed possible to happen. The first
> patch in the series fixes that deadlock, the second one unifies back two
> functions that used to be the same, and finally the last one removes some
> outdated logic and adds an assertion (and documentation) to make sure we
> don't forget about that type of deadlock in case overwrite_item() gets
> used in the future for updating items in a log tree. More details in the
> changelogs of each patch.
> 
> Filipe Manana (3):
>   btrfs: do not modify log tree while holding a leaf from fs tree locked
>   btrfs: unify overwrite_item() and do_overwrite_item()
>   btrfs: remove outdated logic from overwrite_item() and add assertion

Added to misc-next, thanks.