All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 3/5] btrfs: assert tree mod log lock in __tree_mod_log_insert
Date: Fri, 31 May 2019 19:01:25 +0200	[thread overview]
Message-ID: <b5d0e50544f219a444aafc3284fa899f875fab84.1559321947.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1559321947.git.dsterba@suse.com>

The tree is going to be modified so it must be the exclusive lock.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ctree.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 5df76c17775a..99a585ede79d 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -376,8 +376,6 @@ void btrfs_put_tree_mod_seq(struct btrfs_fs_info *fs_info,
  * The 'start address' is the logical address of the *new* root node
  * for root replace operations, or the logical address of the affected
  * block for all other operations.
- *
- * Note: must be called with write lock for fs_info::tree_mod_log_lock.
  */
 static noinline int
 __tree_mod_log_insert(struct btrfs_fs_info *fs_info, struct tree_mod_elem *tm)
@@ -387,6 +385,8 @@ __tree_mod_log_insert(struct btrfs_fs_info *fs_info, struct tree_mod_elem *tm)
 	struct rb_node *parent = NULL;
 	struct tree_mod_elem *cur;
 
+	lockdep_assert_held_exclusive(&fs_info->tree_mod_log_lock);
+
 	tm->seq = btrfs_inc_tree_mod_seq(fs_info);
 
 	tm_root = &fs_info->tree_mod_log;
-- 
2.21.0


  parent reply	other threads:[~2019-05-31 17:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31 17:01 [PATCH 0/5] More lockdep annotations David Sterba
2019-05-31 17:01 ` [PATCH 1/5] btrfs: tests: add locks around add_extent_mapping David Sterba
2019-05-31 17:01 ` [PATCH 2/5] btrfs: assert extent map tree lock in add_extent_mapping David Sterba
2019-05-31 17:01 ` David Sterba [this message]
2019-05-31 17:01 ` [PATCH 4/5] btrfs: assert delayed ref lock in btrfs_find_delayed_ref_head David Sterba
2019-05-31 17:01 ` [PATCH 5/5] btrfs: assert bio list lock in merge_rbio David Sterba
2019-06-05  7:34 ` [PATCH 0/5] More lockdep annotations Nikolay Borisov
2019-06-07 13:31   ` 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=b5d0e50544f219a444aafc3284fa899f875fab84.1559321947.git.dsterba@suse.com \
    --to=dsterba@suse.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.