Skip to content

RFC btrfs: Add a lockdep annotation for the extent bits wait event

Ioannis Angelakopoulos linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs: Add lockdep wrappers around the extent bits locking and unlocking functionsfs/btrfs/extent-io-tree.h fs/btrfs/free-space-cache.c include/trace/events/btrfs.h+34 -00 replies
2/2btrfs: Lockdep annotations for the extent bits wait eventfs/btrfs/ctree.h fs/btrfs/disk-io.c fs/btrfs/extent_io.c +3 more+133 -191 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/2] btrfs: Add a lockdep annotation for the extent bits wait event

Hello,

with this patch series we add a lockdep annotation for the extent bits wait event.

Unfortunately, as it stands this wait event cannot be annotated in a generic way. Specifically, there are cases where the extent bits are locked in one execution context (we have to acquire the lockdep map there) and they are unlocked in another execution context (we have to release the lockdep map there). However, lockdep expects both the acquisition and release of the lockdep map to occur in the same context.

Thus, we opted to manually annotate five important functions that lock extent bits and can be involved in a convoluted deadlock (see
https://lore.kernel.org/linux-btrfs/[email protected]/)

These functions are:
1) find_lock_delalloc_range
2) btrfs_lock_and_flush_ordered_range
3) extent_fiemap
4) btrfs_fallocate
5) btrfs_finish_ordered_io

Important!!! This patch series depends on this patch series
https://lore.kernel.org/linux-btrfs/[email protected]/T/#t

Ioannis Angelakopoulos (2):
btrfs: Add lockdep wrappers around the extent bits locking and
unlocking functions
btrfs: Lockdep annotations for the extent bits wait event

 fs/btrfs/ctree.h             |   1 +
 fs/btrfs/disk-io.c           |   1 +
 fs/btrfs/extent-io-tree.h    |  32 ++++++++++
 fs/btrfs/extent_io.c         | 114 ++++++++++++++++++++++++++++++++---
 fs/btrfs/file.c              |  10 +--
 fs/btrfs/free-space-cache.c  |   1 +
 fs/btrfs/inode.c             |  22 +++++--
 fs/btrfs/ordered-data.c      |   4 +-
 include/trace/events/btrfs.h |   1 +
 9 files changed, 167 insertions(+), 19 deletions(-)
Signature · 1 line
2.30.2