lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAL3q7H6dqV2jF6r-gy1DKBBnq1+mNvvwaQVkAq4VvPYRgVEAfA@mail.gmail.com>
Date: Sun, 11 Jan 2026 19:27:39 +0000
From: Filipe Manana <fdmanana@...nel.org>
To: Jiasheng Jiang <jiashengjiangcool@...il.com>
Cc: Chris Mason <clm@...com>, David Sterba <dsterba@...e.com>, linux-btrfs@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] btrfs: fail metadata async reclaim early if filesystem is aborted

On Sat, Jan 10, 2026 at 8:07 PM Jiasheng Jiang
<jiashengjiangcool@...il.com> wrote:
>
> Currently, do_async_reclaim_metadata_space cycles through all flush
> states even if the filesystem has been aborted. In contrast, the data
> reclaim path (do_async_reclaim_data_space) explicitly checks for
> BTRFS_FS_ERROR and fails all pending tickets immediately.
>
> This inconsistency causes the metadata reclaimer to waste CPU cycles
> performing useless flush operations (like attempting to commit a
> transaction or allocate chunks) on a broken filesystem.

No it doesn't.
If the fs is aborted we can't commit a transaction, etc - all flush
operations return early.

>
> Fix this by adding a BTRFS_FS_ERROR check inside the metadata reclaim
> loop, ensuring that we fail all tickets and exit as soon as a
> filesystem error is detected, matching the behavior of data reclaim.

Honestly I don't think it's worth adding this code.
Not only is flushing a no-op when the fs was aborted, having a
transaction abort is an excepcional and rare event.

Thanks.

>
> Signed-off-by: Jiasheng Jiang <jiashengjiangcool@...il.com>
> ---
>  fs/btrfs/space-info.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
> index 6babbe333741..b3aae44a1436 100644
> --- a/fs/btrfs/space-info.c
> +++ b/fs/btrfs/space-info.c
> @@ -1189,6 +1189,14 @@ static void do_async_reclaim_metadata_space(struct btrfs_space_info *space_info)
>                         spin_unlock(&space_info->lock);
>                         return;
>                 }
> +
> +               if (unlikely(BTRFS_FS_ERROR(fs_info))) {
> +                       maybe_fail_all_tickets(space_info);
> +                       space_info->flush = false;
> +                       spin_unlock(&space_info->lock);
> +                       return;
> +               }
> +
>                 to_reclaim = btrfs_calc_reclaim_metadata_size(space_info);
>                 if (last_tickets_id == space_info->tickets_id) {
>                         flush_state++;
> --
> 2.25.1
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ