archive mirror
 help / color / mirror / Atom feed
From: Eugeniu Rosca <>
To: <>, Greg Kroah-Hartman <>
Cc: <>, <>,
	Maksim Paimushkin <>,
	Matthias Thomae <>,
	Sebastian Unger <>,
	Dirk Behme <>,
	Eugeniu Rosca <>,
	Eugeniu Rosca <>,
	Eugeniu Rosca <>
Subject: Re: [PATCH] btrfs: fix infinite directory reads
Date: Wed, 24 Jan 2024 23:55:22 +0100	[thread overview]
Message-ID: <20240124225522.GA2614102@lxhi-087> (raw)
In-Reply-To: <>

Hello Greg,
Hello Filipe,

On Sun, Aug 13, 2023 at 12:34:08PM +0100, wrote:
> From: Filipe Manana <>
> 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
> a large number of entries such that they won't all fit in the given buffer
> passed to the readdir callback, that is, dir_emit() returns a non-zero
> value. Because in that case readdir() will be called again and if in the
> meanwhile new directory entries were added and we still can't put all the
> remaining entries in the buffer, we keep repeating this over and over.
> The following C program and test script reproduce the problem:

This crucial fix successfully landed into vanilla v6.5 [1] and stable
v6.4.12 [2], but unfortunately not into the older stable trees.

Consequently, the fix is missing on the popular Ubuntu versions like
20.04 (KNL v5.15.x) and 22.04.3 (KNL v6.2.x). For that reason, people
still experience infinite loops when building Linux on those systems.

To overcome the issue, people fall back to workarounds [3-4].

The patch seems to apply cleanly to v6.2, but not to v5.15
(v5.15 backport attempt failed miserably).

Is there a chance for:
 - Stable maintainers to accept the clean backport to v6.2?
 - BTRFS experts to suggest a conflict resolution for v5.15?

[1] https://
[2] https://
[3] https://
[4] https://

Best Regards

  parent reply	other threads:[~2024-01-24 23:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-13 11:34 [PATCH] btrfs: fix infinite directory reads fdmanana
2023-08-13 18:23 ` Filipe Manana
2023-08-14 14:18 ` David Sterba
2024-01-24 22:55 ` Eugeniu Rosca [this message]
2024-01-25 12:04   ` Filipe Manana

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240124225522.GA2614102@lxhi-087 \ \ \ \ \ \ \ \ \ \ \ \

* 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;
as well as URLs for NNTP newsgroup(s).