All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ioannis Angelakopoulos <iangelak@fb.com>
To: <linux-btrfs@vger.kernel.org>, <kernel-team@fb.com>
Subject: [PATCH v2 0/5] btrfs: Annotate wait events with lockdep
Date: Mon, 18 Jul 2022 21:09:50 -0700	[thread overview]
Message-ID: <20220719040954.3964407-1-iangelak@fb.com> (raw)

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 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 (5):
  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: Add a lockdep model for the ordered extents wait event

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

-- 
2.30.2


             reply	other threads:[~2022-07-19  4:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-19  4:09 Ioannis Angelakopoulos [this message]
2022-07-19  4:09 ` [PATCH v2 1/5] btrfs: Add a lockdep model for the num_writers wait event Ioannis Angelakopoulos
2022-07-20 14:46   ` Josef Bacik
2022-07-20 14:47   ` Sweet Tea Dorminy
2022-07-20 17:12     ` Ioannis Angelakopoulos
2022-07-19  4:09 ` [PATCH v2 2/5] btrfs: Add a lockdep model for the num_extwriters " Ioannis Angelakopoulos
2022-07-20 14:46   ` Josef Bacik
2022-07-19  4:09 ` [PATCH v2 3/5] btrfs: Add lockdep models for the transaction states wait events Ioannis Angelakopoulos
2022-07-20 14:47   ` Sweet Tea Dorminy
2022-07-20 17:39     ` Ioannis Angelakopoulos
2022-07-20 14:48   ` Josef Bacik
2022-07-20 17:49     ` Ioannis Angelakopoulos
2022-07-19  4:09 ` [PATCH v2 4/5] btrfs: Add a lockdep model for the pending_ordered wait event Ioannis Angelakopoulos
2022-07-20 14:48   ` Josef Bacik
2022-07-19  4:10 ` [PATCH v2 5/5] btrfs: Add a lockdep model for the ordered extents " Ioannis Angelakopoulos
2022-07-20 14:50   ` Josef Bacik
2022-07-20 14:47 ` [PATCH v2 0/5] btrfs: Annotate wait events with lockdep Sweet Tea Dorminy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220719040954.3964407-1-iangelak@fb.com \
    --to=iangelak@fb.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.