Re: [PATCH v2] btrfs: fix backref walking not returning all inode refs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 04, 2023 at 11:12:03AM +0100, fdmanana@xxxxxxxxxx wrote:
> From: Filipe Manana <fdmanana@xxxxxxxx>
> 
> When using the logical to ino ioctl v2, if the flag to ignore offsets of
> file extent items (BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET) is given, the
> backref walking code ends up not returning references for all file offsets
> of an inode that point to the given logical bytenr. This happens since
> kernel 6.2, commit 6ce6ba534418 ("btrfs: use a single argument for extent
> offset in backref walking functions"), as it mistakenly skipped the search
> for file extent items in a leaf that point to the target extent if that
> flag is given. Instead it should only skip the filtering done by
> check_extent_in_eb() - that is, it should not avoid the calls to that
> function (or find_extent_in_eb(), which uses it).
> 
> So fix this by always calling check_extent_in_eb() and find_extent_in_eb()
> and have check_extent_in_eb() do the filtering only if the flag to ignore
> offsets is set.
> 
> Fixes: 6ce6ba534418 ("btrfs: use a single argument for extent offset in backref walking functions")
> Reported-by: Vladimir Panteleev <git@xxxxxxxxxxxxxxxxxxxxx>
> Link: https://lore.kernel.org/linux-btrfs/CAHhfkvwo=nmzrJSqZ2qMfF-rZB-ab6ahHnCD_sq9h4o8v+M7QQ@xxxxxxxxxxxxxx/
> Tested-by: Vladimir Panteleev <git@xxxxxxxxxxxxxxxxxxxxx>
> CC: stable@xxxxxxxxxxxxxxx # 6.2+
> Signed-off-by: Filipe Manana <fdmanana@xxxxxxxx>
> ---
> 
> V2: Remove wrong check for a non-zero extent item offset.
>     Apply the same logic at find_parent_nodes(), that is, search for file
>     extent items on a leaf if the ignore flag is given - the filtering
>     will be done later at check_extent_in_eb(). Spotted by Vladimir Panteleev
>     in the thread mentioned above.

Replaced in misc-next, thanks for the quick fix.



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux