linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Burkov <boris@bur.io>
To: Goffredo Baroncelli <kreijack@libero.it>
Cc: linux-btrfs@vger.kernel.org, Goffredo Baroncelli <kreijack@inwind.it>
Subject: Re: [PATCH][V2] btrfs-progs: allow autodetect_object_types() to handle link.
Date: Wed, 5 Jan 2022 12:48:36 -0800	[thread overview]
Message-ID: <YdYEJAvLhndfHTIT@zen> (raw)
In-Reply-To: <da4a4e0cf18df259e63c19872093bf12635da576.1641415488.git.kreijack@inwind.it>

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
> 

  reply	other threads:[~2022-01-05 20:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-01-06 14:49 ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YdYEJAvLhndfHTIT@zen \
    --to=boris@bur.io \
    --cc=kreijack@inwind.it \
    --cc=kreijack@libero.it \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).