linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Nikolay Borisov <nborisov@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/3] btrfs: Don't use objectid_mutex during mount
Date: Thu, 10 Oct 2019 18:05:40 +0200	[thread overview]
Message-ID: <20191010160540.GU2751@twin.jikos.cz> (raw)
In-Reply-To: <20191010150647.20940-3-nborisov@suse.com>

On Thu, Oct 10, 2019 at 06:06:46PM +0300, Nikolay Borisov wrote:
> Since the filesystem is not well formed and no trees are loaded it's
> pointless holding the objectid_mutex. Just remove its usage.

Yes.

There's a case when the lock should be kept even in that phase, so we
could add a lockdep assertion, but I found btrfs_recover_log_trees with
a comment why the lock is not needed. Given that
btrfs_find_highest_objectid is used only in a hadnful places, I think
we're fine with just the comments.

> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
>  fs/btrfs/disk-io.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index b850988023aa..72580eb6b706 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -2603,17 +2603,14 @@ int __cold init_tree_roots(struct btrfs_fs_info *fs_info)
>  		tree_root->commit_root = btrfs_root_node(tree_root);
>  		btrfs_set_root_refs(&tree_root->root_item, 1);
>  
> -		mutex_lock(&tree_root->objectid_mutex);

		/*
		 * We don't need to hold objectid_mutex because ...
		 */

>  		ret = btrfs_find_highest_objectid(tree_root,
>  						&tree_root->highest_objectid);
>  		if (ret) {
> -			mutex_unlock(&tree_root->objectid_mutex);
>  			handle_error = true;
>  			continue;
>  		}

  reply	other threads:[~2019-10-10 16:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 15:06 [PATCH 0/3] Cleanups in mount path Nikolay Borisov
2019-10-10 15:06 ` [PATCH 1/3] btrfs: Factor out tree roots initialization during mount Nikolay Borisov
2019-10-11  7:50   ` Johannes Thumshirn
2019-10-11  8:21     ` Nikolay Borisov
2019-10-11  8:23       ` Johannes Thumshirn
2019-10-11  9:31   ` Qu Wenruo
2019-10-11 10:12     ` Nikolay Borisov
2019-10-10 15:06 ` [PATCH 2/3] btrfs: Don't use objectid_mutex " Nikolay Borisov
2019-10-10 16:05   ` David Sterba [this message]
2019-10-10 15:06 ` [PATCH 3/3] btrfs: Jump to correct label on init_root_trees failure Nikolay Borisov

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=20191010160540.GU2751@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    /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;
as well as URLs for NNTP newsgroup(s).