From patchwork Wed Sep 9 15:23:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Mason X-Patchwork-Id: 7147301 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D92ECBEEC1 for ; Wed, 9 Sep 2015 15:23:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DE15820A06 for ; Wed, 9 Sep 2015 15:23:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D757320A05 for ; Wed, 9 Sep 2015 15:23:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754490AbbIIPXg (ORCPT ); Wed, 9 Sep 2015 11:23:36 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:32366 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753989AbbIIPXb (ORCPT ); Wed, 9 Sep 2015 11:23:31 -0400 Received: from pps.filterd (m0044012 [127.0.0.1]) by mx0a-00082601.pphosted.com (8.14.5/8.14.5) with SMTP id t89FBMw5020418; Wed, 9 Sep 2015 08:23:29 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=date : from : to : subject : message-id : mime-version : content-type; s=facebook; bh=01L4cERv9Q8DZlS/BByDE5fI6LiGAzd3s/Et3zDYLVk=; b=qiTZf6gIcz620WtfxVG58LyHR7oNGZ9shfVIi3PcVN1iwJgJBkgcWOOndvV5NKcKpley 1WUi+4ZU9clc6F1n9X6y1mpei4e/8K4Sa6vGRKJvbRTszgn+0rWNn7T09Hk4puzmn3vA VUuVbaUJAbIFjJnE1Nnw4xy5UwyFVZ/eSeA= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 1wtnt4r7qt-6 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Wed, 09 Sep 2015 08:23:29 -0700 Received: from localhost (192.168.52.123) by mail.thefacebook.com (192.168.16.11) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 9 Sep 2015 08:23:25 -0700 Date: Wed, 9 Sep 2015 11:23:23 -0400 From: Chris Mason To: , Josef Bacik , Dave Chinner Subject: [PATCH] fs-writeback: drop wb->list_lock during blk_finish_plug() Message-ID: <20150909152323.GB3784@ret.masoncoding.com> Mail-Followup-To: Chris Mason , linux-fsdevel@vger.kernel.org, Josef Bacik , Dave Chinner MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23.1 (2014-03-12) X-Originating-IP: [192.168.52.123] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151, 1.0.33, 0.0.0000 definitions=2015-09-09_08:2015-09-08, 2015-09-09, 1970-01-01 signatures=0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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 Commit d353d7587 added a plug/finish_plug pair to writeback_sb_inodes, but writeback_sb_inodes has a horrible secret...it's called with the wb->list_lock held. Btrfs raid5/6 and MD raid10 have horrible secrets of their own...they both do allocations in their unplug callbacks. None of the options to fix it are very pretty. We don't want to kick off workers for all of these unplugs, and the lock doesn't look hot enough to justify bigger restructuring. [ 2854.025042] BUG: sleeping function called from invalid context at mm/page_alloc.c:3189 [ 2854.041366] in_atomic(): 1, irqs_disabled(): 0, pid: 145562, name: kworker/u66:15 [ 2854.056813] INFO: lockdep is turned off. [ 2854.064870] CPU: 13 PID: 145562 Comm: kworker/u66:15 Not tainted 4.2.0-mason+ #1 [ 2854.080082] Hardware name: ZTSYSTEMS Echo Ridge T4 /A9DRPF-10D, BIOS 1.07 05/10/2012 [ 2854.096211] Workqueue: writeback wb_workfn (flush-btrfs-244) [ 2854.107821] ffffffff81a2bbee ffff880ee09a7598 ffffffff813307bb ffff880ee09a7598 [ 2854.123162] ffff881010d1ca00 ffff880ee09a75c8 ffffffff81086615 0000000000000000 [ 2854.138556] 0000000000000000 0000000000000c75 ffffffff81a2bbee ffff880ee09a75f8 [ 2854.153936] Call Trace: [ 2854.181101] [] __might_sleep+0x52/0x90 [ 2854.192136] [] __alloc_pages_nodemask+0x344/0xbe0 [ 2854.229682] [] alloc_pages_current+0x10a/0x1e0 [ 2854.255508] [] full_stripe_write+0x59/0xc0 [btrfs] [ 2854.268600] [] __raid56_parity_write+0x39/0x60 [btrfs] [ 2854.282385] [] run_plug+0x11b/0x140 [btrfs] [ 2854.294259] [] btrfs_raid_unplug+0x23/0x70 [btrfs] [ 2854.307334] [] blk_flush_plug_list+0x82/0x1f0 [ 2854.319542] [] blk_finish_plug+0x34/0x50 [ 2854.330878] [] writeback_sb_inodes+0x122/0x580 [ 2854.343256] [] wb_writeback+0x136/0x4e0 Signed-off-by: Chris Mason Reviewed-by: Jens Axboe --- fs/fs-writeback.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index ae0f438..07c9c50 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1539,7 +1539,9 @@ static long writeback_sb_inodes(struct super_block *sb, break; } } + spin_unlock(&wb->list_lock); blk_finish_plug(&plug); + spin_lock(&wb->list_lock); return wrote; }