From: Nikolay Borisov <nborisov@suse.com>
To: Josef Bacik <josef@toxicpanda.com>,
linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH 8/8] btrfs: set the lockdep class for log tree extent buffers
Date: Fri, 21 Aug 2020 16:43:33 +0300 [thread overview]
Message-ID: <64d27518-37f5-70cc-068d-6c893d3f65b2@suse.com> (raw)
In-Reply-To: <968c98eabd41974b5df245fb20234a49491df037.1597936173.git.josef@toxicpanda.com>
On 20.08.20 г. 18:18 ч., Josef Bacik wrote:
> These are special extent buffers that get rewound in order to lookup
> the state of the tree at a specific point in time. As such they do not
> go through the normal initialization paths that set their lockdep class,
> so handle them appropriately when they are created and before they are
> locked.
>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Setting the lockdep class is fine, however in get_old_root your also
reduce the scope of the eb's read lock. That's fine since in the if
(old_root) branch we only set some values to the eb, which is guaranteed
to be a clone/private copy i.e no other references.
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> fs/btrfs/ctree.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
> index 09a0dc690a17..e0fd8a34efcc 100644
> --- a/fs/btrfs/ctree.c
> +++ b/fs/btrfs/ctree.c
> @@ -1297,6 +1297,8 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
> btrfs_tree_read_unlock_blocking(eb);
> free_extent_buffer(eb);
>
> + btrfs_set_buffer_lockdep_class(btrfs_header_owner(eb_rewin),
> + eb_rewin, btrfs_header_level(eb_rewin));
> btrfs_tree_read_lock(eb_rewin);
> __tree_mod_log_rewind(fs_info, eb_rewin, time_seq, tm);
> WARN_ON(btrfs_header_nritems(eb_rewin) >
> @@ -1370,7 +1372,6 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
>
> if (!eb)
> return NULL;
> - btrfs_tree_read_lock(eb);
> if (old_root) {
> btrfs_set_header_bytenr(eb, eb->start);
> btrfs_set_header_backref_rev(eb, BTRFS_MIXED_BACKREF_REV);
> @@ -1378,6 +1379,9 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
> btrfs_set_header_level(eb, old_root->level);
> btrfs_set_header_generation(eb, old_generation);
> }
> + btrfs_set_buffer_lockdep_class(btrfs_header_owner(eb), eb,
> + btrfs_header_level(eb));
> + btrfs_tree_read_lock(eb);
> if (tm)
> __tree_mod_log_rewind(fs_info, eb, time_seq, tm);
> else
>
next prev parent reply other threads:[~2020-08-21 13:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-20 15:18 [PATCH 0/8] Lockdep fixes Josef Bacik
2020-08-20 15:18 ` [PATCH 1/8] btrfs: drop path before adding new uuid tree entry Josef Bacik
2020-08-20 15:18 ` [PATCH 2/8] btrfs: fix potential deadlock in the search ioctl Josef Bacik
2020-08-20 15:18 ` [PATCH 3/8] btrfs: move btrfs_scratch_superblocks into btrfs_dev_replace_finishing Josef Bacik
2020-08-21 12:56 ` Nikolay Borisov
2020-08-20 15:18 ` [PATCH 4/8] btrfs: move btrfs_rm_dev_replace_free_srcdev outside of all locks Josef Bacik
2020-08-20 15:18 ` [PATCH 5/8] btrfs: do not hold device_list_mutex when closing devices Josef Bacik
2020-08-20 15:18 ` [PATCH 6/8] btrfs: allocate scrub workqueues outside of locks Josef Bacik
2020-08-20 15:18 ` [PATCH 7/8] btrfs: set the correct lockdep class for new nodes Josef Bacik
2020-08-21 13:36 ` Nikolay Borisov
2020-08-20 15:18 ` [PATCH 8/8] btrfs: set the lockdep class for log tree extent buffers Josef Bacik
2020-08-21 13:43 ` Nikolay Borisov [this message]
2020-08-26 10:50 ` [PATCH 0/8] Lockdep fixes David Sterba
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=64d27518-37f5-70cc-068d-6c893d3f65b2@suse.com \
--to=nborisov@suse.com \
--cc=josef@toxicpanda.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