linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: add device scanned-by process name in the scan message
@ 2019-10-02 10:30 Anand Jain
  2019-10-02 10:39 ` Nikolay Borisov
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Anand Jain @ 2019-10-02 10:30 UTC (permalink / raw)
  To: linux-btrfs

Its very helpful if we had logged the device scanner process name
to debug the race condition between the systemd-udevd scan and the
user initiated device forget command.

This patch adds scanned-by process name to the scan message.

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

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 788271649726..2c4c89bfafd1 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1011,11 +1011,11 @@ static noinline struct btrfs_device *device_list_add(const char *path,
 		*new_device_added = true;
 
 		if (disk_super->label[0])
-			pr_info("BTRFS: device label %s devid %llu transid %llu %s\n",
-				disk_super->label, devid, found_transid, path);
+			pr_info("BTRFS: device label %s devid %llu transid %llu %s scanned-by %s\n",
+				disk_super->label, devid, found_transid, path, current->comm);
 		else
-			pr_info("BTRFS: device fsid %pU devid %llu transid %llu %s\n",
-				disk_super->fsid, devid, found_transid, path);
+			pr_info("BTRFS: device fsid %pU devid %llu transid %llu %s scanned-by %s\n",
+				disk_super->fsid, devid, found_transid, path, current->comm);
 
 	} else if (!device->name || strcmp(device->name->str, path)) {
 		/*
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] btrfs: add device scanned-by process name in the scan message
  2019-10-02 10:30 [PATCH] btrfs: add device scanned-by process name in the scan message Anand Jain
@ 2019-10-02 10:39 ` Nikolay Borisov
  2019-10-02 10:49   ` Anand Jain
  2019-10-02 11:10   ` David Sterba
  2019-10-02 11:06 ` David Sterba
  2019-10-03 13:24 ` David Sterba
  2 siblings, 2 replies; 7+ messages in thread
From: Nikolay Borisov @ 2019-10-02 10:39 UTC (permalink / raw)
  To: Anand Jain, linux-btrfs



On 2.10.19 г. 13:30 ч., Anand Jain wrote:
> Its very helpful if we had logged the device scanner process name
> to debug the race condition between the systemd-udevd scan and the
> user initiated device forget command.
> 
> This patch adds scanned-by process name to the scan message.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>

Same effect can be achieved (for debugging purposes) if you have used
ftrace on device_list_add without needing to patch the kernel.


I'm somewhat indifferent whether this will be merged or not but I
personally don't see much value in it.

> ---
>  fs/btrfs/volumes.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 788271649726..2c4c89bfafd1 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -1011,11 +1011,11 @@ static noinline struct btrfs_device *device_list_add(const char *path,
>  		*new_device_added = true;
>  
>  		if (disk_super->label[0])
> -			pr_info("BTRFS: device label %s devid %llu transid %llu %s\n",
> -				disk_super->label, devid, found_transid, path);
> +			pr_info("BTRFS: device label %s devid %llu transid %llu %s scanned-by %s\n",
> +				disk_super->label, devid, found_transid, path, current->comm);
>  		else
> -			pr_info("BTRFS: device fsid %pU devid %llu transid %llu %s\n",
> -				disk_super->fsid, devid, found_transid, path);
> +			pr_info("BTRFS: device fsid %pU devid %llu transid %llu %s scanned-by %s\n",
> +				disk_super->fsid, devid, found_transid, path, current->comm);
>  
>  	} else if (!device->name || strcmp(device->name->str, path)) {
>  		/*
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] btrfs: add device scanned-by process name in the scan message
  2019-10-02 10:39 ` Nikolay Borisov
@ 2019-10-02 10:49   ` Anand Jain
  2019-10-02 11:10   ` David Sterba
  1 sibling, 0 replies; 7+ messages in thread
From: Anand Jain @ 2019-10-02 10:49 UTC (permalink / raw)
  To: Nikolay Borisov, linux-btrfs

On 10/2/19 6:39 PM, Nikolay Borisov wrote:
> 
> 
> On 2.10.19 г. 13:30 ч., Anand Jain wrote:
>> Its very helpful if we had logged the device scanner process name
>> to debug the race condition between the systemd-udevd scan and the
>> user initiated device forget command.
>>
>> This patch adds scanned-by process name to the scan message.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> 
> Same effect can be achieved (for debugging purposes) if you have used
> ftrace on device_list_add without needing to patch the kernel.
>
> I'm somewhat indifferent whether this will be merged or not but I
> personally don't see much value in it.

  Its always good to provide a completely cooked log messages.
  Half cooked ideas or the log messages leads to more questions
  than answers.

Thanks, Anand

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] btrfs: add device scanned-by process name in the scan message
  2019-10-02 10:30 [PATCH] btrfs: add device scanned-by process name in the scan message Anand Jain
  2019-10-02 10:39 ` Nikolay Borisov
@ 2019-10-02 11:06 ` David Sterba
  2019-10-03 13:24 ` David Sterba
  2 siblings, 0 replies; 7+ messages in thread
From: David Sterba @ 2019-10-02 11:06 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs

On Wed, Oct 02, 2019 at 06:30:48PM +0800, Anand Jain wrote:
> Its very helpful if we had logged the device scanner process name
> to debug the race condition between the systemd-udevd scan and the
> user initiated device forget command.
> 
> This patch adds scanned-by process name to the scan message.

Then PID should be printed as well, otherwise ok.

> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  fs/btrfs/volumes.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 788271649726..2c4c89bfafd1 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -1011,11 +1011,11 @@ static noinline struct btrfs_device *device_list_add(const char *path,
>  		*new_device_added = true;
>  
>  		if (disk_super->label[0])
> -			pr_info("BTRFS: device label %s devid %llu transid %llu %s\n",
> -				disk_super->label, devid, found_transid, path);
> +			pr_info("BTRFS: device label %s devid %llu transid %llu %s scanned-by %s\n",
> +				disk_super->label, devid, found_transid, path, current->comm);
>  		else
> -			pr_info("BTRFS: device fsid %pU devid %llu transid %llu %s\n",
> -				disk_super->fsid, devid, found_transid, path);
> +			pr_info("BTRFS: device fsid %pU devid %llu transid %llu %s scanned-by %s\n",

			pr_info("BTRFS: device fsid %pU devid %llu transid %llu %s scanned by %s(%d)\n",

I'm not sure if %di si the right specifier for pid, the format name(pid)
can be seen in other messages.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] btrfs: add device scanned-by process name in the scan message
  2019-10-02 10:39 ` Nikolay Borisov
  2019-10-02 10:49   ` Anand Jain
@ 2019-10-02 11:10   ` David Sterba
  1 sibling, 0 replies; 7+ messages in thread
From: David Sterba @ 2019-10-02 11:10 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: Anand Jain, linux-btrfs

On Wed, Oct 02, 2019 at 01:39:03PM +0300, Nikolay Borisov wrote:
> 
> 
> On 2.10.19 г. 13:30 ч., Anand Jain wrote:
> > Its very helpful if we had logged the device scanner process name
> > to debug the race condition between the systemd-udevd scan and the
> > user initiated device forget command.
> > 
> > This patch adds scanned-by process name to the scan message.
> > 
> > Signed-off-by: Anand Jain <anand.jain@oracle.com>
> 
> Same effect can be achieved (for debugging purposes) if you have used
> ftrace on device_list_add without needing to patch the kernel.

For reproducible issues adding a debugging hooks is fine but races can
be tricky and device scanning depends on the state of the system and
other processes so I understand the need to document what happens for
post-mortem analysis.

> I'm somewhat indifferent whether this will be merged or not but I
> personally don't see much value in it.

We have messages for many administrative tasks, either requested by
users or by developers so I don't object in principle against adding
more.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] btrfs: add device scanned-by process name in the scan message
  2019-10-02 10:30 [PATCH] btrfs: add device scanned-by process name in the scan message Anand Jain
  2019-10-02 10:39 ` Nikolay Borisov
  2019-10-02 11:06 ` David Sterba
@ 2019-10-03 13:24 ` David Sterba
  2019-10-03 13:33   ` Anand Jain
  2 siblings, 1 reply; 7+ messages in thread
From: David Sterba @ 2019-10-03 13:24 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs

On Wed, Oct 02, 2019 at 06:30:48PM +0800, Anand Jain wrote:
> Its very helpful if we had logged the device scanner process name
> to debug the race condition between the systemd-udevd scan and the
> user initiated device forget command.
> 
> This patch adds scanned-by process name to the scan message.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>

Added to misc-next with the updated message.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] btrfs: add device scanned-by process name in the scan message
  2019-10-03 13:24 ` David Sterba
@ 2019-10-03 13:33   ` Anand Jain
  0 siblings, 0 replies; 7+ messages in thread
From: Anand Jain @ 2019-10-03 13:33 UTC (permalink / raw)
  To: dsterba, linux-btrfs



On 3/10/19 9:24 PM, David Sterba wrote:
> On Wed, Oct 02, 2019 at 06:30:48PM +0800, Anand Jain wrote:
>> Its very helpful if we had logged the device scanner process name
>> to debug the race condition between the systemd-udevd scan and the
>> user initiated device forget command.
>>
>> This patch adds scanned-by process name to the scan message.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> 
> Added to misc-next with the updated message.
> 

oops I had v2 with pid.
sorry for the delay I got stuck with a debugging.

Sending it now.

Thanks, Anand

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-10-03 13:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-02 10:30 [PATCH] btrfs: add device scanned-by process name in the scan message Anand Jain
2019-10-02 10:39 ` Nikolay Borisov
2019-10-02 10:49   ` Anand Jain
2019-10-02 11:10   ` David Sterba
2019-10-02 11:06 ` David Sterba
2019-10-03 13:24 ` David Sterba
2019-10-03 13:33   ` Anand Jain

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).