Skip to contentSkip to conversation

btrfs scrub process prevents system suspend

DISCUSSION Jakub Klinkovský 4 participants 5 messages Mar 20, 2014 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Today I accidentally discovered that it is not possible to suspend (hibernate) the system while the btrfs scrub process is running (see the attached log). Could this be considered a bug, or did I miss something?

Some more info:

$ uname -a
Linux asusntb 3.13.6-1-ARCH #1 SMP PREEMPT Fri Mar 7 22:47:48 CET 2014 x86_64 GNU/Linux

and btrfs-progs-3.12 is installed.

Regards,
Jakub Klinkovský

Mar 20 09:03:13 asusntb systemd[1]: Starting Sleep.
Mar 20 09:03:13 asusntb systemd[1]: Reached target Sleep.
Mar 20 09:03:13 asusntb systemd[1]: Starting Hibernate...
Mar 20 09:03:13 asusntb systemd-sleep[12696]: Suspending system...
Mar 20 09:03:34 asusntb kernel: PM: Syncing filesystems ... done.
Mar 20 09:03:34 asusntb kernel: Freezing user space processes ...
Mar 20 09:03:34 asusntb kernel: Freezing of tasks failed after 20.004 seconds (1 tasks refusing to freeze, wq_busy=0):
Mar 20 09:03:34 asusntb kernel: btrfs           D 00000000ffffffff     0  9695      1 0x00000004
Mar 20 09:03:34 asusntb kernel:  ffff880101249920 0000000000000082 ffff8800baf02400 ffff880101249fd8
Mar 20 09:03:34 asusntb kernel:  0000000000014440 0000000000014440 ffff8800baf02400 ffff8800baf02400
Mar 20 09:03:34 asusntb kernel:  0000000000000001 ffff8800baf02400 ffff88013fff9b08 ffff8800baf02400
Mar 20 09:03:34 asusntb kernel: Call Trace:
Mar 20 09:03:34 asusntb kernel:  [<ffffffff8117e5c3>] ? alloc_pages_current+0xa3/0x160
Mar 20 09:03:34 asusntb kernel:  [<ffffffff81515d99>] schedule+0x29/0x70
Mar 20 09:03:34 asusntb kernel:  [<ffffffffa0c2df3d>] scrub_pages+0x38d/0x4e0 [btrfs]
Mar 20 09:03:34 asusntb kernel:  [<ffffffff810a2c30>] ? __wake_up_sync+0x20/0x20
Mar 20 09:03:34 asusntb kernel:  [<ffffffffa0c2eb68>] scrub_stripe+0x998/0x1110 [btrfs]
Mar 20 09:03:34 asusntb kernel:  [<ffffffffa0bd7a06>] ? btrfs_buffer_uptodate+0x56/0x80 [btrfs]
Mar 20 09:03:34 asusntb kernel:  [<ffffffffa0c30bdb>] scrub_chunk.isra.12+0x10b/0x130 [btrfs]
Mar 20 09:03:34 asusntb kernel:  [<ffffffffa0c30e54>] scrub_enumerate_chunks+0x254/0x510 [btrfs]
Mar 20 09:03:34 asusntb kernel:  [<ffffffff810a2c00>] ? __wake_up_sync_key+0x50/0x60
Mar 20 09:03:34 asusntb kernel:  [<ffffffffa0c312ac>] btrfs_scrub_dev+0x19c/0x4f0 [btrfs]
Mar 20 09:03:34 asusntb kernel:  [<ffffffffa0c0f078>] btrfs_ioctl+0x1528/0x27a0 [btrfs]
Mar 20 09:03:34 asusntb kernel:  [<ffffffff8107b5a6>] ? __queue_work+0x136/0x360
Mar 20 09:03:34 asusntb kernel:  [<ffffffff8151d5c4>] ? __do_page_fault+0x2c4/0x5b0
Mar 20 09:03:34 asusntb kernel:  [<ffffffff81292716>] ? put_io_context+0x66/0xa0
Mar 20 09:03:34 asusntb kernel:  [<ffffffff811b6080>] do_vfs_ioctl+0x2e0/0x4c0
Mar 20 09:03:34 asusntb kernel:  [<ffffffff811b62e1>] SyS_ioctl+0x81/0xa0
Mar 20 09:03:34 asusntb kernel:  [<ffffffff8151d8be>] ? do_page_fault+0xe/0x10
Mar 20 09:03:34 asusntb kernel:  [<ffffffff815216ad>] system_call_fastpath+0x1a/0x1f
Mar 20 09:03:34 asusntb kernel:
Mar 20 09:03:34 asusntb systemd-logind[246]: Lid closed.
Mar 20 09:03:34 asusntb kernel: Restarting tasks ... done.
Mar 20 09:03:34 asusntb kernel: video LNXVIDEO:00: Restoring backlight state
Mar 20 09:03:34 asusntb systemd[1]: systemd-hibernate.service: main process exited, code=exited, status=1/FAILURE
Mar 20 09:03:34 asusntb systemd[1]: Failed to start Hibernate.
Mar 20 09:03:34 asusntb systemd[1]: Dependency failed for Hibernate.
Mar 20 09:03:34 asusntb systemd[1]: Service sleep.target is not needed anymore. Stopping.
Mar 20 09:03:34 asusntb systemd[1]: Unit systemd-hibernate.service entered failed state.
Mar 20 09:03:34 asusntb systemd[1]: Stopping Sleep.
Mar 20 09:03:34 asusntb systemd[1]: Stopped target Sleep.
Mar 20 09:03:34 asusntb systemd[1]: Stopping Hibernate.
Mar 20 09:03:34 asusntb systemd[1]: Stopped target Hibernate.
#1 lore raw
Quoted 11 lines · Jakub Klinkovský

Today I accidentally discovered that it is not possible to suspend (hibernate) the system while the btrfs scrub process is running (see the attached log). Could this be considered a bug, or did I miss something?

Some more info:

$ uname -a
Linux asusntb 3.13.6-1-ARCH #1 SMP PREEMPT Fri Mar 7 22:47:48 CET 2014 x86_64 GNU/Linux

and btrfs-progs-3.12 is installed.

Yeah there's a way to make suspend run commands while it goes down, you'll want to make it do btrfs scrub cancel on your btrfs fses. If you search the archives you'll see we've covered this recently and the guy posted the script he was using. Thanks,

Josef

#2 lore raw
In reply to Josef Bacik
Quoted 4 lines · Josef Bacik

Yeah there's a way to make suspend run commands while it goes down, you'll want to make it do btrfs scrub cancel on your btrfs fses. If you search the archives you'll see we've covered this recently and the guy posted the script he was using. Thanks,

I've started putting some of the recent stuff I've written and found out in blog posts so that google can index them more easily.

This one has my btrfs scrub script and sec.conf to catch errors that btrfs reports to syslog that that most would miss:
http://marc.merlins.org/perso/btrfs/post_2014-03-19_Btrfs-Tips_-Btrfs-Scrub-and-Btrfs-Filesystem-Repair.html
(also explains the different data recovery strategy and why you don't really need fsck)

Then this one deals specifically with cancelling btrfs scrubs before going to sleep:
http://marc.merlins.org/perso/btrfs/post_2014-03-20_Btrfs-Tips_-ACPI-S3-Sleep-aka-Suspend-And-Btrfs-Scrub.html
My guess is that pause/resume might be enough, I just haven't spent the time on doing that yet.

Cheers,
Marc

Signature · 4 lines
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/