diff mbox series

[V5,4/4] btrfs: fix comment about the btrfs_show_devname

Message ID c3e2f34f0d328196dd7cd6bdae67a8219cef840c.1629780501.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrf_show_devname related fixes | expand

Commit Message

Anand Jain Aug. 24, 2021, 5:05 a.m. UTC
There were few lock dep warnings because btrfs_show_devname() was using
device_list_mutex as recorded in the commits
  ccd05285e7f (btrfs: fix a possible umount deadlock)
  779bf3fefa8 (btrfs: fix lock dep warning, move scratch dev out of
  device_list_mutex and uuid_mutex)

And finally, commit 88c14590cdd6 (btrfs: use RCU in btrfs_show_devname
for device list traversal) removed the device_list_mutex from
btrfs_show_devname for performance reasons.

This patch fixes a stale comment about the function btrfs_show_devname.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/volumes.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

David Sterba Sept. 2, 2021, 2:26 p.m. UTC | #1
On Tue, Aug 24, 2021 at 01:05:22PM +0800, Anand Jain wrote:
> There were few lock dep warnings because btrfs_show_devname() was using
> device_list_mutex as recorded in the commits
>   ccd05285e7f (btrfs: fix a possible umount deadlock)
>   779bf3fefa8 (btrfs: fix lock dep warning, move scratch dev out of
>   device_list_mutex and uuid_mutex)
> 
> And finally, commit 88c14590cdd6 (btrfs: use RCU in btrfs_show_devname
> for device list traversal) removed the device_list_mutex from
> btrfs_show_devname for performance reasons.
> 
> This patch fixes a stale comment about the function btrfs_show_devname.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  fs/btrfs/volumes.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 8470c5b5f35e..1d1204547e72 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -2278,10 +2278,7 @@ void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev)
>  
>  	/*
>  	 * The update_dev_time() with in btrfs_scratch_superblocks()
> -	 * may lead to a call to btrfs_show_devname() which will try
> -	 * to hold device_list_mutex. And here this device
> -	 * is already out of device list, so we don't have to hold
> -	 * the device_list_mutex lock.
> +	 * may lead to a call to btrfs_show_devname().

I think the whole comment can be deleted, it was there namely for the
device_list_mutex and potential problems with show_devname, but this is
now sorted. What's remaining is that btrfs_scratch_superblocks happens
out of all locks but it's IMO clear from the code that the device is
being now disconnected from all structures and freed.
David Sterba Sept. 2, 2021, 2:38 p.m. UTC | #2
On Tue, Aug 24, 2021 at 01:05:22PM +0800, Anand Jain wrote:
> There were few lock dep warnings because btrfs_show_devname() was using
> device_list_mutex as recorded in the commits
>   ccd05285e7f (btrfs: fix a possible umount deadlock)

Commit ccd05285e7f does not exist in my tree, but the subject matches
0ccd05285e7f. Please format the references like it's done for the Fixes:
tag with HASH ("Subject"). Nobody types that by hand, a simple git alias
does that for free:

.gitconfig:
[alias]
	one = show -s --pretty='format:%h (\"%s\")'
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 8470c5b5f35e..1d1204547e72 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2278,10 +2278,7 @@  void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev)
 
 	/*
 	 * The update_dev_time() with in btrfs_scratch_superblocks()
-	 * may lead to a call to btrfs_show_devname() which will try
-	 * to hold device_list_mutex. And here this device
-	 * is already out of device list, so we don't have to hold
-	 * the device_list_mutex lock.
+	 * may lead to a call to btrfs_show_devname().
 	 */
 	btrfs_scratch_superblocks(tgtdev->fs_info, tgtdev->bdev,
 				  tgtdev->name->str);