On Tue, Jul 14, 2020 at 02:21:53PM -0300, Marcos Paulo de Souza wrote:
> From: Marcos Paulo de Souza <mpdesouza@xxxxxxxx>
> In volumes.c there are comments stating that chunk_mutex is used to
> protect add/remove chunks, trim or add/remove devices. Since
> btrfs_read_chunk_tree is only called on mount, and trim and chunk alloc
> cannot happen at mount time, it's safe to remove this lock/unlock.
>
> Also, btrfs_ioctl_{add|rm}_dev calls set BTRFS_FS_EXCL_OP, which should
> be safe.
I've analyzed it in
https://lore.kernel.org/linux-btrfs/20200512232827.GI18421@xxxxxxxxxxxxx/
and an ioctl gets called during mount with the seeding device. I don't
see it mentioned in your changelog.
The BTRFS_FS_EXCL_OP do not affect that because there's only one the
device add at this time.
> Dropping the mutex lock/unlock solves the lockdep warning.
Yes, but the question is if this is also correct :) Right now I don't
see how the excl_op flag is relevant here.
The patch proposed in
https://lore.kernel.org/linux-btrfs/20200513194659.34493-1-anand.jain@xxxxxxxxxx/
has some issues, I tried to fix them back then but for some reason I
don't remember the patch did not work as expected.