mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: daan@amutable.com, Chris Mason <clm@fb.com>,
	David Sterba <dsterba@suse.com>
Cc: Qu Wenruo <wqu@suse.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: fix GET_SUBVOL_INFO after compat refactor
Date: Mon, 13 Jul 2026 18:24:43 +0930	[thread overview]
Message-ID: <f29fc4cd-10a7-4342-80be-2d1cb2ac293d@gmx.com> (raw)
In-Reply-To: <20260713-btrfs-get-subvol-info-fix-v1-1-a58cc55b3696@amutable.com>



在 2026/7/13 17:20, Daan De Meyer via B4 Relay 写道:
> From: Daan De Meyer <daan@amutable.com>
> 
> btrfs_search_slot() returns a positive value when the search key does
> not exactly match an item. This is expected here, since offset 0 is used
> to find the first ROOT_BACKREF for the subvolume and the actual key has
> the parent root ID as its offset.
> 
> Before the compat ioctl refactoring, the native handler still copied the
> filled structure to userspace when the search returned 1. After the
> lookup was moved to a shared helper, both native and compat callers
> treat the positive return value as a failure and skip copy_to_user(),
> leaving BTRFS_IOC_GET_SUBVOL_INFO unusable for non-top-level
> subvolumes.
> 
> Reset ret after successfully validating and reading the ROOT_BACKREF so
> the helper reports success and both callers copy the result to
> userspace.
> 
> Fixes: 538e5bdbc899 ("btrfs: add 32-bit compat ioctl for BTRFS_IOC_GET_SUBVOL_INFO")
> Signed-off-by: Daan De Meyer <daan@amutable.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
> Fix BTRFS_IOC_GET_SUBVOL_INFO for non-top-level subvolumes after the
> recent 32-bit compat ioctl refactor.
> ---
>   fs/btrfs/ioctl.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index 9d47d16394fc..ab6c17716026 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -2042,6 +2042,7 @@ static int _btrfs_ioctl_get_subvol_info(struct inode *inode,
>   			ret = -ENOENT;
>   			goto out;
>   		}
> +		ret = 0;
>   	}
>   
>   out:
> 
> ---
> base-commit: cab9e339cfbc1a4e075e53e281dfb00391e1a6bb
> change-id: 20260713-btrfs-get-subvol-info-fix-e93803926554
> 
> Best regards,
> --
> Daan De Meyer <daan@amutable.com>
> 
> 
> 


      reply	other threads:[~2026-07-13  8:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13  7:50 Daan De Meyer via B4 Relay
2026-07-13  8:54 ` Qu Wenruo [this message]

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=f29fc4cd-10a7-4342-80be-2d1cb2ac293d@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=clm@fb.com \
    --cc=daan@amutable.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wqu@suse.com \
    /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

all inboxes | Powered by JetHome®