Hi Filipe and Qu,
On Thu, Jan 25, 2024 at 10:02:01AM +0000, Filipe Manana wrote:
On Thu, Jan 25, 2024 at 9:51 AM Qu Wenruo wqu@suse.com wrote:
From: Filipe Manana fdmanana@suse.com
[ Upstream commit 9b378f6ad48cfa195ed868db9123c09ee7ec5ea2 ]
The readdir implementation currently processes always up to the last index it finds. This however can result in an infinite loop if the directory has
[..]
Thanks for the backport, and running the corresponding test case from fstests to verify it's working.
However when backporting a commit, one should also check if there are fixes for that commit, as they often introduce regressions or have some other bug -
+1. Good to see this best practice applied here.
and that's the case here. We also need to backport the following 3 commits:
https:// git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=357950361cbc6d54fb68ed878265c647384684ae https:// git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e60aa5da14d01fed8411202dbe4adf6c44bd2a57 https:// git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8e7f82deb0c0386a03b62e30082574347f8b57d5
Good catch. I get the same list thanks to the reference of the culprit:
$ git log --oneline --grep 9b378f6ad linux/master 8e7f82deb0c038 btrfs: fix race between reading a directory and adding entries to it e60aa5da14d01f btrfs: refresh dir last index during a rewinddir(3) call 357950361cbc6d btrfs: set last dir index to the current last index when opening dir
One regression, the one regarding rewinddir(3), even has a test case in fstests too (generic/471) and would have been caught when running the "dir" group tests in fstests:
https:// git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git/commit/?h=for-next&id=68b958f5dc4ab13cfd86f7fb82621f9f022b7626
I'll work on making backports of those 3 other patches on top of your backport, and then send all of them in a series, including your patch, to make it easier to follow and apply all at once.
Thanks for your support. Looking forward.
BR, Eugeniu