Re: [PATCH 3/4 for 5.15 stable] btrfs: refresh dir last index during a rewinddir(3) call

Eugeniu Rosca
2024-01-26T19:08:19Z

On Thu, Jan 25, 2024 at 11:59:37AM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> commit e60aa5da14d01fed8411202dbe4adf6c44bd2a57 upstream.
>
> When opening a directory we find what's the index of its last entry and
> then store it in the directory's file handle private data (struct
> btrfs_file_private::last_index), so that in the case new directory entries
> are added to a directory after an opendir(3) call we don't end up in an
> infinite loop (see commit 9b378f6ad48c ("btrfs: fix infinite directory
> reads")) when calling readdir(3).

[..]

> Fixes: 9b378f6ad48c ("btrfs: fix infinite directory reads")
> CC: stable@vger.kernel.org # 6.5+
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
> Signed-off-by: David Sterba <dsterba@suse.com>

Based on https://lore.kernel.org/stable/20240126185534.GA2668448@lxhi-087:

Reviewed-by: Eugeniu Rosca <eugeniu.rosca@bosch.com>