Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH v3 0/6]  btrfs: Annotate wait events with lockdep
@ 2022-07-20 23:38 Ioannis Angelakopoulos
  2022-07-20 23:38 ` [PATCH v3 1/6] btrfs: Add a lockdep model for the num_writers wait event Ioannis Angelakopoulos
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Ioannis Angelakopoulos @ 2022-07-20 23:38 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

Hello,

With this patch series we annotate wait events in btrfs with lockdep to
catch deadlocks involving these wait events.

Recently the btrfs developers fixed a non trivial deadlock involving
wait events
https://lore.kernel.org/linux-btrfs/20220614131413.GJ20633@twin.jikos.cz/

Currently lockdep is unable to catch these deadlocks since it does not
support wait events by default.

With our lockdep annotations we train lockdep to track these wait events
and catch more potential deadlocks.

Specifically, we annotate the below wait events in fs/btrfs/transaction.c
and in fs/btrfs/ordered-data.c:

  1) The num_writers wait event
  2) The num_extwriters wait event
  3) The transaction states wait events
  4) The pending_ordered wait event
  5) The ordered extents wait event

Changes from v2:
  1) Added macros to initialize the lockdep maps so that the code is
  cleaner.
  2) Added comments related to the acquisition of the lockdep maps
  by threads either as readers or writers.
  3) Moved the transaction states annotation in wait_for_commit() in
  fs/btrfs/transaction.c to make the code cleaner.
  4) Separated the lockdep class change of invalidate_lock and the
  ordered extents wait event annotation into 2 patches.

Changes from v1:
  1) Added 2 labels in the cleanup code of btrfs_commit_transaction() in
  fs/btrfs/transaction.c so that btrfs_lockdep_release() is not called
  multiple times during the error paths.
  2) Added lockdep annotations for the btrfs transaction states wait
  events.
  3) Added a lockdep annotation for the pending_ordered wait event.
  4) Added a lockdep annotation for the ordered extents wait event.

Ioannis Angelakopoulos (6):
  btrfs: Add a lockdep model for the num_writers wait event
  btrfs: Add a lockdep model for the num_extwriters wait event
  btrfs: Add lockdep models for the transaction states wait events
  btrfs: Add a lockdep model for the pending_ordered wait event
  btrfs: Change the lockdep class of struct inode's invalidate_lock
  btrfs: Add a lockdep model for the ordered extents wait event

 fs/btrfs/ctree.h            |  82 ++++++++++++++++++++++++++++
 fs/btrfs/disk-io.c          |  13 +++++
 fs/btrfs/free-space-cache.c |  11 ++++
 fs/btrfs/inode.c            |  13 +++++
 fs/btrfs/ordered-data.c     |  21 +++++++
 fs/btrfs/transaction.c      | 106 ++++++++++++++++++++++++++++++++----
 6 files changed, 235 insertions(+), 11 deletions(-)

-- 
2.30.2


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

end of thread, other threads:[~2022-07-22 13:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-20 23:38 [PATCH v3 0/6] btrfs: Annotate wait events with lockdep Ioannis Angelakopoulos
2022-07-20 23:38 ` [PATCH v3 1/6] btrfs: Add a lockdep model for the num_writers wait event Ioannis Angelakopoulos
2022-07-21  0:42   ` Wang Yugui
2022-07-21 16:37     ` Ioannis Angelakopoulos
2022-07-20 23:38 ` [PATCH v3 2/6] btrfs: Add a lockdep model for the num_extwriters " Ioannis Angelakopoulos
2022-07-20 23:38 ` [PATCH v3 3/6] btrfs: Add lockdep models for the transaction states wait events Ioannis Angelakopoulos
2022-07-20 23:38 ` [PATCH v3 4/6] btrfs: Add a lockdep model for the pending_ordered wait event Ioannis Angelakopoulos
2022-07-20 23:38 ` [PATCH v3 5/6] btrfs: Change the lockdep class of struct inode's invalidate_lock Ioannis Angelakopoulos
2022-07-20 23:38 ` [PATCH v3 6/6] btrfs: Add a lockdep model for the ordered extents wait event Ioannis Angelakopoulos
2022-07-22 13:36 ` [PATCH v3 0/6] btrfs: Annotate wait events with lockdep Josef Bacik

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