All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][V2] btrfs-progs: allow autodetect_object_types() to handle link.
@ 2022-01-05 20:45 Goffredo Baroncelli
  2022-01-05 20:48 ` Boris Burkov
  2022-01-06 14:49 ` David Sterba
  0 siblings, 2 replies; 3+ messages in thread
From: Goffredo Baroncelli @ 2022-01-05 20:45 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Boris Burkov, Goffredo Baroncelli

From: Goffredo Baroncelli <kreijack@inwind.it>

The function autodetect_object_types() tries to detect the type of
btrfs object passed. If it is an "inode" type (e.g. file) this function
returns the type as "inode". If it is a block device, it return it as
"block device".
However it doesn't handle the case where the object passed is a link
to a block device (which could be a valid btrfs device). For example
LVM/DM creates link to block devices. In this case it should return
the type as "block device".

This patch replace the lstat() call with a stat().

Reported-by: Boris Burkov <boris@bur.io>
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
---
 cmds/property.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmds/property.c b/cmds/property.c
index 59ef997c..b3ccc0ff 100644
--- a/cmds/property.c
+++ b/cmds/property.c
@@ -373,7 +373,7 @@ static int autodetect_object_types(const char *object, int *types_out)
 
 	is_btrfs_object = check_btrfs_object(object);
 
-	ret = lstat(object, &st);
+	ret = stat(object, &st);
 	if (ret < 0) {
 		ret = -errno;
 		goto out;
-- 
2.34.1


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

* Re: [PATCH][V2] btrfs-progs: allow autodetect_object_types() to handle link.
  2022-01-05 20:45 [PATCH][V2] btrfs-progs: allow autodetect_object_types() to handle link Goffredo Baroncelli
@ 2022-01-05 20:48 ` Boris Burkov
  2022-01-06 14:49 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Burkov @ 2022-01-05 20:48 UTC (permalink / raw)
  To: Goffredo Baroncelli; +Cc: linux-btrfs, Goffredo Baroncelli

On Wed, Jan 05, 2022 at 09:45:52PM +0100, Goffredo Baroncelli wrote:
> From: Goffredo Baroncelli <kreijack@inwind.it>
> 
> The function autodetect_object_types() tries to detect the type of
> btrfs object passed. If it is an "inode" type (e.g. file) this function
> returns the type as "inode". If it is a block device, it return it as
> "block device".
> However it doesn't handle the case where the object passed is a link
> to a block device (which could be a valid btrfs device). For example
> LVM/DM creates link to block devices. In this case it should return
> the type as "block device".
> 
> This patch replace the lstat() call with a stat().
> 
> Reported-by: Boris Burkov <boris@bur.io>
Reviewed-by: Boris Burkov <boris@bur.io>
> Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
> ---
>  cmds/property.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cmds/property.c b/cmds/property.c
> index 59ef997c..b3ccc0ff 100644
> --- a/cmds/property.c
> +++ b/cmds/property.c
> @@ -373,7 +373,7 @@ static int autodetect_object_types(const char *object, int *types_out)
>  
>  	is_btrfs_object = check_btrfs_object(object);
>  
> -	ret = lstat(object, &st);
> +	ret = stat(object, &st);
>  	if (ret < 0) {
>  		ret = -errno;
>  		goto out;
> -- 
> 2.34.1
> 

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

* Re: [PATCH][V2] btrfs-progs: allow autodetect_object_types() to handle link.
  2022-01-05 20:45 [PATCH][V2] btrfs-progs: allow autodetect_object_types() to handle link Goffredo Baroncelli
  2022-01-05 20:48 ` Boris Burkov
@ 2022-01-06 14:49 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2022-01-06 14:49 UTC (permalink / raw)
  To: Goffredo Baroncelli; +Cc: linux-btrfs, Boris Burkov, Goffredo Baroncelli

On Wed, Jan 05, 2022 at 09:45:52PM +0100, Goffredo Baroncelli wrote:
> From: Goffredo Baroncelli <kreijack@inwind.it>
> 
> The function autodetect_object_types() tries to detect the type of
> btrfs object passed. If it is an "inode" type (e.g. file) this function
> returns the type as "inode". If it is a block device, it return it as
> "block device".
> However it doesn't handle the case where the object passed is a link
> to a block device (which could be a valid btrfs device). For example
> LVM/DM creates link to block devices. In this case it should return
> the type as "block device".
> 
> This patch replace the lstat() call with a stat().
> 
> Reported-by: Boris Burkov <boris@bur.io>
> Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>

Added to devel, thanks.

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

end of thread, other threads:[~2022-01-06 14:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 20:45 [PATCH][V2] btrfs-progs: allow autodetect_object_types() to handle link Goffredo Baroncelli
2022-01-05 20:48 ` Boris Burkov
2022-01-06 14:49 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.