Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Askar Safin <safinaskar@gmail.com>
To: quwenruo.btrfs@gmx.com
Cc: dsterba@suse.com, linux-btrfs@vger.kernel.org,
	lists@colorremedies.com, wqu@suse.com
Subject: Re: [PATCH RFC] btrfs: exit scrub and balance early if the fs is being frozen
Date: Wed, 15 Oct 2025 14:12:17 +0300	[thread overview]
Message-ID: <20251015111217.5538-1-safinaskar@gmail.com> (raw)
In-Reply-To: <8c3628d5-8fce-45a1-b29c-65c2c52f1c06@gmx.com>

I just noticed that suspend behavior depends on whether "btrfs scrub" is
started in terminal window or as a systemd service. I think this is because
systemd tries to freeze user session when suspending, but doesn't freeze
services.

So I retested everything.

All tests were done with my distro's version of btrfs-progs (6.14-1).
My distro is Debian Trixie.
I have btrfs raid-1, which spans two actual partitions, 3.5 TiB each.

Let's start with unpatched v6.18-rc1.

- scrub in win, freeze_filesystems=0 - suspend doesn't work

- scrub as a service, freeze_filesystems=0 - suspend doesn't work

- scrub in win, freeze_filesystems=1
suspend takes 6-10 mins. I. e. the system hangs for 6-10 mins and then
suspends. I suspect this is time needed to complete scrub

- scrub as a service, freeze_filesystems=1 - the same

Also: on unpatched kernel "btrfs scrub" terminates instantly if it receives
INT, but doesn't terminate if it receives KILL, TERM or HUP.

Now v6.18-rc1 with your old 7 Jul 2025 patch
( https://lore.kernel.org/linux-btrfs/9606fae20bff6c1fbe14dc7b067f3b333c2a955b.1751847905.git.wqu@suse.com/ ).

- scrub in win, freeze_filesystems=0 - suspend doesn't work

- scrub as a service, freeze_filesystems=0 - suspend doesn't work

- scrub in win, freeze_filesystems=1
suspend takes 1 min. I. e. the system hangs for 1 min, then suspends

- scrub as a service, freeze_filesystems=1
suspend works perfectly. I. e. the system instantly suspends. I don't even
notice 19s delay you are talking about

Now v6.18-rc1 with your new 15 Oct 2025 patch
( https://lore.kernel.org/linux-btrfs/8c3628d5-8fce-45a1-b29c-65c2c52f1c06@gmx.com/ ).

- scrub in win, freeze_filesystems=0 - hangs for 60s, then suspends

- scrub as a service, freeze_filesystems=0 - works perfectly, i. e. suspends instantly

- scrub in win, freeze_filesystems=1 - hangs for 60s, then suspends
here is journalctl: https://zerobin.net/?7b394069a9050b8d#7PrnCDJV2t9inNFS3/EhxHJUS24iSGX7FAmjUstKKr4=

- scrub as a service, freeze_filesystems=1 - works perfectly, i. e. suspends instantly

-- 
Askar Safin

  parent reply	other threads:[~2025-10-15 11:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-07  0:25 [PATCH RFC] btrfs: exit scrub and balance early if the fs is being frozen Qu Wenruo
2025-07-07  5:23 ` Qu Wenruo
2025-07-07 12:30   ` David Sterba
2025-07-07 12:37     ` Daniel Vacek
2025-07-07 22:16     ` Qu Wenruo
2025-07-07 12:25 ` David Sterba
2025-10-12  8:23 ` Askar Safin
2025-10-12 23:56   ` Qu Wenruo
2025-10-15  4:05     ` Askar Safin
2025-10-15  7:00   ` Qu Wenruo
2025-10-15  7:59     ` Askar Safin
2025-10-15  8:07       ` Qu Wenruo
2025-10-15 11:12     ` Askar Safin [this message]
2025-10-15 23:01       ` Qu Wenruo
2025-10-16  8:40         ` Askar Safin
2025-10-16  9:46           ` Qu Wenruo

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20251015111217.5538-1-safinaskar@gmail.com \
    --to=safinaskar@gmail.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lists@colorremedies.com \
    --cc=quwenruo.btrfs@gmx.com \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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