From patchwork Mon Mar 3 06:50:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 3751511 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D1F0B9F376 for ; Mon, 3 Mar 2014 06:52:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EEEF72039E for ; Mon, 3 Mar 2014 06:52:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE94620303 for ; Mon, 3 Mar 2014 06:52:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753507AbaCCGw0 (ORCPT ); Mon, 3 Mar 2014 01:52:26 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:27727 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752263AbaCCGwZ (ORCPT ); Mon, 3 Mar 2014 01:52:25 -0500 X-IronPort-AV: E=Sophos;i="4.97,576,1389715200"; d="scan'208,223";a="9635579" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 03 Mar 2014 14:48:31 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s236qMv6007946; Mon, 3 Mar 2014 14:52:22 +0800 Received: from [10.167.226.104] ([10.167.226.104]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2014030314495319-338030 ; Mon, 3 Mar 2014 14:49:53 +0800 Message-ID: <53142639.3030600@cn.fujitsu.com> Date: Mon, 03 Mar 2014 14:50:33 +0800 From: Wang Shilong User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130612 Thunderbird/17.0.6 MIME-Version: 1.0 To: Marc MERLIN CC: linux-btrfs@vger.kernel.org Subject: Re: 3.14.0-rc3 btrfs scrub is preventing my laptop from going to sleep References: <20140227190656.GA28338@merlins.org> <530FE3CE.70809@cn.fujitsu.com> <20140301050937.GD18300@merlins.org> <20140301152235.GA26926@merlins.org> <5313F45F.9090709@cn.fujitsu.com> <20140303052147.GB24835@merlins.org> In-Reply-To: <20140303052147.GB24835@merlins.org> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2014/03/03 14:49:53, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2014/03/03 14:49:54, Serialize complete at 2014/03/03 14:49:54 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 > 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 From 7c0564d5604581dc0ed868de4dbb1ed8d8fbd55f Mon Sep 17 00:00:00 2001 From: Wang Shilong Date: Mon, 3 Mar 2014 14:34:07 +0800 Subject: [PATCH] Btrfs: add schedule points for scrub Signed-off-by: Wang Shilong --- 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