On Thu, Jan 25, 2024 at 11:59:38AM +0000, fdmanana@kernel.org wrote:
From: Filipe Manana fdmanana@suse.com
commit 8e7f82deb0c0386a03b62e30082574347f8b57d5 upstream.
When opening a directory (opendir(3)) or rewinding it (rewinddir(3)), we are not holding the directory's inode locked, and this can result in later attempting to add two entries to the directory with the same index number, resulting in a transaction abort, with -EEXIST (-17), when inserting the second delayed dir index. This results in a trace like the following:
[..]
Fixes: 9b378f6ad48c ("btrfs: fix infinite directory reads") CC: stable@vger.kernel.org # 6.5+ Signed-off-by: Filipe Manana fdmanana@suse.com Reviewed-by: David Sterba dsterba@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