From: Nikolay Borisov <nborisov@suse.com>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 1/4] btrfs: Use rcu when iterating devices in btrfs_init_new_device
Date: Wed, 22 Jul 2020 13:36:15 +0300 [thread overview]
Message-ID: <f8a7bab8-98dc-55c6-5adf-7d0ee95bb3a6@suse.com> (raw)
In-Reply-To: <SN4PR0401MB3598E3FEB988273A2709414B9B790@SN4PR0401MB3598.namprd04.prod.outlook.com>
On 22.07.20 г. 12:17 ч., Johannes Thumshirn wrote:
> On 22/07/2020 10:09, Nikolay Borisov wrote:
>> When adding a new device there's a mandatory check to see if a device is
>> being duplicated to the filesystem it's added to. Since this is a
>> read-only operations not necessary to take device_list_mutex and can simply
>> make do with an rcu-readlock. No semantics changes.
>
> Hmm what are the actual locking rules for the device list? For instance looking
> at add_missing_dev() in volumes.c addition to the list is unprotected (both from
> read_one_chunk() and read_one_dev()). Others (i.e. btrfs_init_new_device()) do
> a list_add_rcu(). clone_fs_devices() takes the device_list_mutex and so on.
Bummer, the locking rules are supposed to be those documented atop
volume.c, namely:
* fs_devices::device_list_mutex (per-fs, with RCU)
18 * ------------------------------------------------
17 * protects updates to fs_devices::devices, ie. adding and
deleting
16 *
15 * simple list traversal with read-only actions can be done with
RCU protection
14 *
13 * may be used to exclude some operations from running
concurrently without any
12 * modifications to the list (see write_all_supers)
However, your observations seem correct and rather annoying. Let me go
and try and figure this out...
>
> Thanks,
> Johannes
>
next prev parent reply other threads:[~2020-07-22 10:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-22 8:09 [PATCH 0/4] Misc cleanups around device addition Nikolay Borisov
2020-07-22 8:09 ` [PATCH 1/4] btrfs: Use rcu when iterating devices in btrfs_init_new_device Nikolay Borisov
2020-07-22 9:17 ` Johannes Thumshirn
2020-07-22 10:36 ` Nikolay Borisov [this message]
2020-07-22 14:47 ` David Sterba
2020-07-22 14:53 ` Johannes Thumshirn
2020-07-23 7:45 ` Nikolay Borisov
2020-07-22 8:09 ` [PATCH 2/4] btrfs: Refactor locked condition " Nikolay Borisov
2020-07-30 4:31 ` Anand Jain
2020-07-22 8:09 ` [PATCH 3/4] btrfs: Remove redundant code from btrfs_free_stale_devices Nikolay Borisov
2020-07-30 5:01 ` Anand Jain
2020-07-22 8:09 ` [PATCH 4/4] btrfs: Don't opencode sync_blockdev Nikolay Borisov
2020-07-22 9:20 ` Johannes Thumshirn
2020-07-30 5:05 ` Anand Jain
2020-08-26 16:07 ` [PATCH 0/4] Misc cleanups around device addition Nikolay Borisov
2020-08-28 15:48 ` 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=f8a7bab8-98dc-55c6-5adf-7d0ee95bb3a6@suse.com \
--to=nborisov@suse.com \
--cc=Johannes.Thumshirn@wdc.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;
as well as URLs for NNTP newsgroup(s).