From: Ioannis Angelakopoulos <iangelak@fb.com>
To: <linux-btrfs@vger.kernel.org>, <kernel-team@fb.com>
Subject: [PATCH v3 0/6] btrfs: Annotate wait events with lockdep
Date: Wed, 20 Jul 2022 16:38:13 -0700 [thread overview]
Message-ID: <20220720233818.3107724-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 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
next reply other threads:[~2022-07-20 23:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-20 23:38 Ioannis Angelakopoulos [this message]
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
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=20220720233818.3107724-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox