From patchwork Thu Apr 23 15:17:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Mason X-Patchwork-Id: 6263891 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B2AA19F313 for ; Thu, 23 Apr 2015 15:17:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C91692038D for ; Thu, 23 Apr 2015 15:17:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 943A62038C for ; Thu, 23 Apr 2015 15:17:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965310AbbDWPRP (ORCPT ); Thu, 23 Apr 2015 11:17:15 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:6578 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965217AbbDWPRO (ORCPT ); Thu, 23 Apr 2015 11:17:14 -0400 Received: from pps.filterd (m0004060 [127.0.0.1]) by mx0b-00082601.pphosted.com (8.14.5/8.14.5) with SMTP id t3NFH6J2008579; Thu, 23 Apr 2015 08:17:09 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=facebook; bh=6DaZMwX/N0kMSfrOyPu4sIn/FYf1garI2Gov9NM4aZI=; b=AP7WSgye2WYtiTva0T/Nnh7uFxOczmKqxXustwIoYWVrIz2L//O6AaL2uMRv2XYVC+vt Iybz0QKh/AoqGiBfBSHfexxRNgkui3SZ+qThObRG0q0DTQo34WOyRUcYG0uAuO4USNr4 alLurkeU/PqFXOBnbHpimmPGwPz0xuJd4hE= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 1ty1y8rajd-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Thu, 23 Apr 2015 08:17:09 -0700 Received: from localhost (192.168.16.4) by mail.thefacebook.com (192.168.16.11) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 23 Apr 2015 08:17:06 -0700 Date: Thu, 23 Apr 2015 11:17:04 -0400 From: Chris Mason To: Filipe David Manana CC: Holger =?iso-8859-1?Q?Hoffst=E4tte?= , "linux-btrfs@vger.kernel.org" Subject: Re: [PATCH 0/4] btrfs: reduce block group cache writeout times during commit Message-ID: <20150423151704.GA25585@ret.masoncoding.com> Mail-Followup-To: Chris Mason , Filipe David Manana , Holger =?iso-8859-1?Q?Hoffst=E4tte?= , "linux-btrfs@vger.kernel.org" References: <1428954759-1304912-1-git-send-email-clm@fb.com> <5537D27E.3080609@fb.com> <5538EB05.7050200@fb.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [192.168.16.4] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68, 1.0.33, 0.0.0000 definitions=2015-04-23_06:2015-04-23, 2015-04-23, 1970-01-01 signatures=0 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.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 On Thu, Apr 23, 2015 at 02:05:48PM +0100, Filipe David Manana wrote: > >> Trying the current integration-4.1 branch, I ran into the following > >> during xfstests/btrfs/049: > >> > > > > Ugh, I must not be waiting correctly in one of the inode cache writeout > > sections. But I've run 049 a whole bunch of times without triggering, > > can you get this to happen consistently? > > All the time so far. I'm testing with this now: commit 9f433238891b1b243c4f19d3f36eed913b270cbc Author: Chris Mason Date: Thu Apr 23 08:02:49 2015 -0700 Btrfs: fix inode cache writeout The code to fix stalls during free spache cache IO wasn't using the correct root when waiting on the IO for inode caches. This is only a problem when the inode cache is enabled with mount -o inode_cache This fixes the inode cache writeout to preserve any error values and makes sure not to override the root when inode cache writeout is done. Reported-by: Filipe Manana Signed-off-by: Chris Mason --- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 5a4f5d1..8cd797f 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -1149,7 +1149,8 @@ int btrfs_wait_cache_io(struct btrfs_root *root, if (!inode) return 0; - root = root->fs_info->tree_root; + if (block_group) + root = root->fs_info->tree_root; /* Flush the dirty pages in the cache file. */ ret = flush_dirty_cache(inode); @@ -3465,9 +3466,12 @@ int btrfs_write_out_ino_cache(struct btrfs_root *root, if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return 0; + memset(&io_ctl, 0, sizeof(io_ctl)); ret = __btrfs_write_out_cache(root, inode, ctl, NULL, &io_ctl, - trans, path, 0) || - btrfs_wait_cache_io(root, trans, NULL, &io_ctl, path, 0); + trans, path, 0); + if (!ret) + ret = btrfs_wait_cache_io(root, trans, NULL, &io_ctl, path, 0); + if (ret) { btrfs_delalloc_release_metadata(inode, inode->i_size); #ifdef DEBUG