Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] btrfs: Add a lockdep annotation for the extent bits wait event
@ 2022-08-12  0:42 Ioannis Angelakopoulos
  2022-08-12  0:42 ` [RFC PATCH 1/2] btrfs: Add lockdep wrappers around the extent bits locking and unlocking functions Ioannis Angelakopoulos
  2022-08-12  0:42 ` [RFC PATCH 2/2] btrfs: Lockdep annotations for the extent bits wait event Ioannis Angelakopoulos
  0 siblings, 2 replies; 4+ messages in thread
From: Ioannis Angelakopoulos @ 2022-08-12  0:42 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

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/cover.1655147296.git.josef@toxicpanda.com/)

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/20220812001734.1587514-1-iangelak@fb.com/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(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-23 21:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-12  0:42 [RFC PATCH 0/2] btrfs: Add a lockdep annotation for the extent bits wait event Ioannis Angelakopoulos
2022-08-12  0:42 ` [RFC PATCH 1/2] btrfs: Add lockdep wrappers around the extent bits locking and unlocking functions Ioannis Angelakopoulos
2022-08-12  0:42 ` [RFC PATCH 2/2] btrfs: Lockdep annotations for the extent bits wait event Ioannis Angelakopoulos
2022-08-23 21:02   ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox