diff mbox

3.14.0-rc3 btrfs scrub is preventing my laptop from going to sleep

Message ID 53142639.3030600@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wang Shilong March 3, 2014, 6:50 a.m. UTC
On 03/03/2014 01:21 PM, Marc MERLIN wrote:
> On Mon, Mar 03, 2014 at 11:17:51AM +0800, Wang Shilong wrote:
>> Hi Marc,
>>
>> On 03/01/2014 11:22 PM, Marc MERLIN wrote:
>>> On Fri, Feb 28, 2014 at 09:09:37PM -0800, Marc MERLIN wrote:
>>>> On Fri, Feb 28, 2014 at 09:18:06AM +0800, Wang Shilong wrote:
>>>>> Could you run the following command when scrub is blocked, we can know more
>>>>> why scrub is blocked here.
>>>>>
>>>>> # echo w >  /proc/sysrq-trigger
>>>>> # dmesg
>>> Yes, there you go:
>>>
>>> (attached because it's too big for the list)
>>>
>>> http://marc.merlins.org/tmp/btrfs_nofreeze.txt
>> Could you please try the following patch, and let's see if it helps:
>>
>> https://patchwork.kernel.org/patch/3680431/
> I just applied your patch, along with the other btrfs send patch to
> 3.14.0-rc5
>
> I didn't help with ACPI sleep. Do you have a laptop you can try this on?
> It'll likely be faster than me doing this remotely :)
>
> Here's the log of failure:
> http://marc.merlins.org/tmp/btrfs_nofreeze2.txt

Unfortunately, i could not reproduce this problem here.

It should not be the problem that i addressed before, there is not 
deadlock here.
try the attached patch and hopely it could solve your problem.(I know 
this is
not polite:-) )

If the attached patch could not solve your problem, i will find a laptop and
try to reproduce myself.

>   
>> This patch addressed a deadlock for device replace, but i guess scrub
>> may also trigger this problem if there are errors related to the disk.
> Hope the log above helps.
>   
>> BTW, is there  some errors related to scrub device, something like:
>>
>> # btrfs device stat <device>
> You mean this?
> legolas:~# btrfs scrub stat /dev/mapper/cryptroot
> scrub status for 4850ee22-bf32-4131-a841-02abdb4a5ba6
> 	scrub started at Sun Mar  2 20:52:21 2014, running for 1587 seconds
> 	total bytes scrubbed: 298.96GiB with 1 errors
> 	error details: csum=1
> 	corrected errors: 0, uncorrectable errors: 1, unverified errors: 0
BTW, I suppose you should use datacow option for btrfs, but here scrub 
time is a little longer.
(1578s for 300g).. Was your filesystem on pressure while running scrub.

Thanks,
Wang
>
>   
> Thanks,
> Marc

Comments

Marc MERLIN March 3, 2014, 3:10 p.m. UTC | #1
On Mon, Mar 03, 2014 at 02:50:33PM +0800, Wang Shilong wrote:
> >Here's the log of failure:
> >http://marc.merlins.org/tmp/btrfs_nofreeze2.txt
> 
> Unfortunately, i could not reproduce this problem here.
> 
> It should not be the problem that i addressed before, there is not
> deadlock here.
> try the attached patch and hopely it could solve your problem.(I
> know this is
> not polite:-) )
 
No worries, I appreciate your help, if you can't reproduce yourself I'm
happy to help.

> If the attached patch could not solve your problem, i will find a laptop and
> try to reproduce myself.

Unfortunately that didn't help

Freezing of tasks failed after 20.007 seconds (1 tasks refusing to freeze

btrfs           D ffff8803b212e900     0 15484      1 0x00000084
 ffff8803b2353958 0000000000000082 ffff8803b2353fd8 ffff8803b212e3d0
 00000000000141c0 ffff8803b212e3d0 ffff88040311e000 ffff8800cd098600
 0000000000000000 ffff8803aa3a6740 ffff88040311e220 ffff8803b2353968
Call Trace:
 [<ffffffff8160c311>] schedule+0x73/0x75
 [<ffffffff8126eb66>] scrub_pages+0x27e/0x42b
 [<ffffffff810850c9>] ? finish_wait+0x65/0x65
 [<ffffffff81271951>] scrub_stripe+0xada/0xca3
 [<ffffffff81271bf0>] scrub_chunk.isra.9+0xd6/0x10d
 [<ffffffff81271e9a>] scrub_enumerate_chunks+0x273/0x49f
 [<ffffffff81085000>] ? prepare_to_wait_event+0xba/0xf2
 [<ffffffff81272666>] btrfs_scrub_dev+0x254/0x3cb
 [<ffffffff8116dde3>] ? __mnt_want_write+0x62/0x78
 [<ffffffff81255e82>] btrfs_ioctl+0x1114/0x24b1
 [<ffffffff81015efa>] ? paravirt_sched_clock+0x9/0xd
 [<ffffffff810164a0>] ? sched_clock+0x9/0xb
 [<ffffffff811408bd>] ? ____cache_alloc+0x23e/0x29b
 [<ffffffff81140a09>] ? kmem_cache_alloc_node+0xef/0x179
 [<ffffffff8160e9eb>] ? _raw_spin_unlock+0x17/0x2a
 [<ffffffff81163b16>] do_vfs_ioctl+0x3d2/0x41d
 [<ffffffff8116bd38>] ? __fget+0x6f/0x79
 [<ffffffff81163bb8>] SyS_ioctl+0x57/0x82
 [<ffffffff816154ad>] system_call_fastpath+0x1a/0x1f

Restarting tasks ... done.

Cheers,
Marc
diff mbox

Patch

From 7c0564d5604581dc0ed868de4dbb1ed8d8fbd55f Mon Sep 17 00:00:00 2001
From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Date: Mon, 3 Mar 2014 14:34:07 +0800
Subject: [PATCH] Btrfs: add schedule points for scrub

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
---
 fs/btrfs/scrub.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 682ec3fc..0a00db0 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -2064,6 +2064,7 @@  leave_nomem:
 			scrub_block_put(sblock);
 			return ret;
 		}
+		cond_resched();
 	}
 
 	if (force)
@@ -2229,6 +2230,7 @@  behind_scrub_pages:
 		logical += l;
 		physical += l;
 		physical_for_dev_replace += l;
+		cond_resched();
 	}
 	return 0;
 }
-- 
1.9.0