diff mbox series

[1/5] btrfs: fix comment its device list mutex not volume lock

Message ID 1549609355-11053-2-git-send-email-anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series Misc props.c cleanups | expand

Commit Message

Anand Jain Feb. 8, 2019, 7:02 a.m. UTC
We have killed volume mutex (commit: dccdb07bc996
btrfs: kill btrfs_fs_info::volume_mutex) update comment. This a trival one
seems to have escaped.

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

Comments

Nikolay Borisov Feb. 8, 2019, 7:07 a.m. UTC | #1
On 8.02.19 г. 9:02 ч., Anand Jain wrote:
> We have killed volume mutex (commit: dccdb07bc996
> btrfs: kill btrfs_fs_info::volume_mutex) update comment. This a trival one
> seems to have escaped.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  fs/btrfs/volumes.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index fe122e6099ae..8160749cd9ba 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -1129,7 +1129,7 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig)
>  	mutex_lock(&orig->device_list_mutex);
>  	fs_devices->total_devices = orig->total_devices;
>  
> -	/* We have held the volume lock, it is safe to get the devices. */
> +	/* We have held the device_list_mutex, it is safe to get the devices. */

I'd rather have the comment replaced with lockdep_assert_held it's a lot
more eloquent.

>  	list_for_each_entry(orig_dev, &orig->devices, dev_list) {
>  		struct rcu_string *name;
>  
>
Anand Jain Feb. 8, 2019, 7:16 a.m. UTC | #2
On 2/8/19 3:07 PM, Nikolay Borisov wrote:
> 
> 
> On 8.02.19 г. 9:02 ч., Anand Jain wrote:
>> We have killed volume mutex (commit: dccdb07bc996
>> btrfs: kill btrfs_fs_info::volume_mutex) update comment. This a trival one
>> seems to have escaped.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>>   fs/btrfs/volumes.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>> index fe122e6099ae..8160749cd9ba 100644
>> --- a/fs/btrfs/volumes.c
>> +++ b/fs/btrfs/volumes.c
>> @@ -1129,7 +1129,7 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig)
>>   	mutex_lock(&orig->device_list_mutex);
>>   	fs_devices->total_devices = orig->total_devices;
>>   
>> -	/* We have held the volume lock, it is safe to get the devices. */
>> +	/* We have held the device_list_mutex, it is safe to get the devices. */
> 
> I'd rather have the comment replaced with lockdep_assert_held it's a lot
> more eloquent.

   I agree if we don't acquire the required lock in the same function,
   but here, we call the required mutex_lock(&orig->device_list_mutex);
   just three lines above in the same function.

   Where do we need the lockdep_assert_held()?

-Anand

>>   	list_for_each_entry(orig_dev, &orig->devices, dev_list) {
>>   		struct rcu_string *name;
>>   
>>
Nikolay Borisov Feb. 8, 2019, 7:19 a.m. UTC | #3
On 8.02.19 г. 9:16 ч., Anand Jain wrote:
> 
> 
> On 2/8/19 3:07 PM, Nikolay Borisov wrote:
>>
>>
>> On 8.02.19 г. 9:02 ч., Anand Jain wrote:
>>> We have killed volume mutex (commit: dccdb07bc996
>>> btrfs: kill btrfs_fs_info::volume_mutex) update comment. This a
>>> trival one
>>> seems to have escaped.
>>>
>>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>>> ---
>>>   fs/btrfs/volumes.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>>> index fe122e6099ae..8160749cd9ba 100644
>>> --- a/fs/btrfs/volumes.c
>>> +++ b/fs/btrfs/volumes.c
>>> @@ -1129,7 +1129,7 @@ static struct btrfs_fs_devices
>>> *clone_fs_devices(struct btrfs_fs_devices *orig)
>>>       mutex_lock(&orig->device_list_mutex);
>>>       fs_devices->total_devices = orig->total_devices;
>>>   -    /* We have held the volume lock, it is safe to get the
>>> devices. */
>>> +    /* We have held the device_list_mutex, it is safe to get the
>>> devices. */
>>
>> I'd rather have the comment replaced with lockdep_assert_held it's a lot
>> more eloquent.
> 
>   I agree if we don't acquire the required lock in the same function,
>   but here, we call the required mutex_lock(&orig->device_list_mutex);
>   just three lines above in the same function.
> 
>   Where do we need the lockdep_assert_held()?

You are right I missed that. In that case I'd say just remove the
comment it should be obvious what's happening.

> 
> -Anand
> 
>>>       list_for_each_entry(orig_dev, &orig->devices, dev_list) {
>>>           struct rcu_string *name;
>>>  
>
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index fe122e6099ae..8160749cd9ba 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1129,7 +1129,7 @@  static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig)
 	mutex_lock(&orig->device_list_mutex);
 	fs_devices->total_devices = orig->total_devices;
 
-	/* We have held the volume lock, it is safe to get the devices. */
+	/* We have held the device_list_mutex, it is safe to get the devices. */
 	list_for_each_entry(orig_dev, &orig->devices, dev_list) {
 		struct rcu_string *name;