diff mbox

[16/23] Btrfs: device path change must be logged

Message ID 1439548388-29686-17-git-send-email-anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Anand Jain Aug. 14, 2015, 10:33 a.m. UTC
From the issue diagnosable point of view, log if the device path is
changed.

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

Comments

David Sterba Oct. 1, 2015, 1:40 p.m. UTC | #1
On Fri, Aug 14, 2015 at 06:33:01PM +0800, Anand Jain wrote:
> >From the issue diagnosable point of view, log if the device path is
> changed.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  fs/btrfs/volumes.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index ebf37a9..dcb10fa 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -595,6 +595,10 @@ static noinline int device_list_add(const char *path,

>  			return -EEXIST;
>  		}
>  
> +		printk_in_rcu(KERN_INFO \
> +			"BTRFS: device fsid %pU devid %llu old path %s new path %s\n",
> +			disk_super->fsid, devid, rcu_str_deref(device->name), path);

I don't think that the message should be put into device_list_add. Its
only callsite in btrfs_scan_one_device prints some device info messages
so it would be better to extend and use the return value if possible.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Anand Jain Oct. 1, 2015, 1:47 p.m. UTC | #2
On 10/01/2015 09:40 PM, David Sterba wrote:
> On Fri, Aug 14, 2015 at 06:33:01PM +0800, Anand Jain wrote:
>> >From the issue diagnosable point of view, log if the device path is
>> changed.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>>   fs/btrfs/volumes.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>> index ebf37a9..dcb10fa 100644
>> --- a/fs/btrfs/volumes.c
>> +++ b/fs/btrfs/volumes.c
>> @@ -595,6 +595,10 @@ static noinline int device_list_add(const char *path,
>
>>   			return -EEXIST;
>>   		}
>>
>> +		printk_in_rcu(KERN_INFO \
>> +			"BTRFS: device fsid %pU devid %llu old path %s new path %s\n",
>> +			disk_super->fsid, devid, rcu_str_deref(device->name), path);
>
> I don't think that the message should be put into device_list_add. Its
> only callsite in btrfs_scan_one_device prints some device info messages
> so it would be better to extend and use the return value if possible.


  Right. will fix it.

Thanks, Anand


> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Anand Jain Oct. 5, 2015, 8:50 a.m. UTC | #3
Hi David,

  Kindly note. This is accepted and sent out as part of the patch
  which are dependinding together.

Thanks, Anand

On 10/01/2015 09:47 PM, Anand Jain wrote:
>
>
> On 10/01/2015 09:40 PM, David Sterba wrote:
>> On Fri, Aug 14, 2015 at 06:33:01PM +0800, Anand Jain wrote:
>>> >From the issue diagnosable point of view, log if the device path is
>>> changed.
>>>
>>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>>> ---
>>>   fs/btrfs/volumes.c | 4 ++++
>>>   1 file changed, 4 insertions(+)
>>>
>>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>>> index ebf37a9..dcb10fa 100644
>>> --- a/fs/btrfs/volumes.c
>>> +++ b/fs/btrfs/volumes.c
>>> @@ -595,6 +595,10 @@ static noinline int device_list_add(const char
>>> *path,
>>
>>>               return -EEXIST;
>>>           }
>>>
>>> +        printk_in_rcu(KERN_INFO \
>>> +            "BTRFS: device fsid %pU devid %llu old path %s new path
>>> %s\n",
>>> +            disk_super->fsid, devid, rcu_str_deref(device->name),
>>> path);
>>
>> I don't think that the message should be put into device_list_add. Its
>> only callsite in btrfs_scan_one_device prints some device info messages
>> so it would be better to extend and use the return value if possible.
>
>
>   Right. will fix it.
>
> Thanks, Anand
>
>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index ebf37a9..dcb10fa 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -595,6 +595,10 @@  static noinline int device_list_add(const char *path,
 			return -EEXIST;
 		}
 
+		printk_in_rcu(KERN_INFO \
+			"BTRFS: device fsid %pU devid %llu old path %s new path %s\n",
+			disk_super->fsid, devid, rcu_str_deref(device->name), path);
+
 		name = rcu_string_strdup(path, GFP_NOFS);
 		if (!name)
 			return -ENOMEM;