From patchwork Tue Mar 26 13:30:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 2336371 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 4DB30DF264 for ; Tue, 26 Mar 2013 13:31:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934178Ab3CZNa5 (ORCPT ); Tue, 26 Mar 2013 09:30:57 -0400 Received: from dkim1.fusionio.com ([66.114.96.53]:54436 "EHLO dkim1.fusionio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933808Ab3CZNa5 (ORCPT ); Tue, 26 Mar 2013 09:30:57 -0400 Received: from mx1.fusionio.com (unknown [10.101.1.160]) by dkim1.fusionio.com (Postfix) with ESMTP id 9B1527C0402 for ; Tue, 26 Mar 2013 07:30:56 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fusionio.com; s=default; t=1364304656; bh=iFYWWc4kjYbTP+8097kgFVAtO/qYULNiRFOIfcIxnQo=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=PeJWQ5st1O0wyqhifEzU7y3iSZ4urn9Q4i6v4s6BFn8IM7V5snWdhjLZ0OdkUnnpD wtDq8lq2jMYihbWJHP1JOGFWnstXrsKCpGZ2FJTHHxOeAs+EIUezNI8DLqdib5Ylyl qqWXiHKfwuuW/rrpXF60QMA7H/FMJse+8KpD4VME= X-ASG-Debug-ID: 1364304655-03d6a52abeed380001-6jHSXT Received: from mail1.int.fusionio.com (mail1.int.fusionio.com [10.101.1.21]) by mx1.fusionio.com with ESMTP id YEXmPZM6wf1fSdqS (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO); Tue, 26 Mar 2013 07:30:56 -0600 (MDT) X-Barracuda-Envelope-From: JBacik@fusionio.com Received: from localhost (98.26.82.158) by mail.fusionio.com (10.101.1.19) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 26 Mar 2013 07:30:55 -0600 Date: Tue, 26 Mar 2013 09:30:53 -0400 From: Josef Bacik To: Stefan Priebe - Profihost AG CC: Josef Bacik , Chris Mason , "linux-btrfs@vger.kernel.org" Subject: Re: No space left on device (28) Message-ID: <20130326133053.GK1955@localhost.localdomain> X-ASG-Orig-Subj: Re: No space left on device (28) References: <20130322135322.GB1955@localhost.localdomain> <514C6319.7030400@profihost.ag> <20130322155453.GD1955@localhost.localdomain> <514CAC8D.7010409@profihost.ag> <20130322204932.GE1955@localhost.localdomain> <514CC52B.1000201@profihost.ag> <20130325201426.GG1955@localhost.localdomain> <51515226.9010509@profihost.ag> <20130326125319.GH1955@localhost.localdomain> <51519ABB.4030207@profihost.ag> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <51519ABB.4030207@profihost.ag> User-Agent: Mutt/1.5.21 (2011-07-01) X-Barracuda-Connect: mail1.int.fusionio.com[10.101.1.21] X-Barracuda-Start-Time: 1364304656 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: http://10.101.1.180:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at fusionio.com X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using per-user scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.126292 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Tue, Mar 26, 2013 at 06:55:23AM -0600, Stefan Priebe - Profihost AG wrote: > Hi Josef, > > Am 26.03.2013 13:53, schrieb Josef Bacik: > > On Tue, Mar 26, 2013 at 01:45:42AM -0600, Stefan Priebe wrote: > >> Hi, > >> > >> output here: > >> [ 590.546162] returning enospc, space_info 3, size 0 reserved 0, flush > >> 2, flush_state 7 dumping space info > >> [ 590.548280] space_info 4 has 6439292928 free, is full > >> [ 590.548283] space_info total=25748307968, used=19308916736, pinned=0, > >> reserved=32768, may_use=6438354944, readonly=65536 > >> [ 590.550147] returning enospc, space_info 3, size 0 reserved 0, flush > >> 2, flush_state 7 dumping space info > >> [ 590.552264] space_info 4 has 6439284736 free, is full > >> [ 590.552267] space_info total=25748307968, used=19308916736, pinned=0, > >> reserved=40960, may_use=6438354944, readonly=65536 > >> [ 590.554141] returning enospc, space_info 3, size 0 reserved 0, flush > >> 2, flush_state 7 dumping space info > >> [ 590.556258] space_info 4 has 6439284736 free, is full > >> [ 590.556261] space_info total=25748307968, used=19308916736, pinned=0, > >> reserved=40960, may_use=6438354944, readonly=65536 > >> [ 591.145255] returning enospc, space_info 3, size 0 reserved 0, flush > >> 2, flush_state 7 dumping space info > >> [ 591.147373] space_info 4 has 6439235584 free, is full > >> [ 591.147375] space_info total=25748307968, used=19308916736, pinned=0, > >> reserved=90112, may_use=6438354944, readonly=65536 > >> [ 595.560257] returning enospc, space_info 3, size 0 reserved 0, flush > >> 2, flush_state 7 dumping space info > >> [ 595.562390] space_info 4 has 6439120896 free, is full > >> [ 595.562393] space_info total=25748307968, used=19309047808, pinned=0, > >> reserved=73728, may_use=6438297600, readonly=65536 > >> > > > > Weird, we have all the flushing stuff set and yet there is still a whole lot of > > outstanding reservations. Do you have compression enabled? Thanks, > > no - it's just mounted with mount -o noatime > > :~# cat /proc/mounts | grep btrfs > /dev/mapper/raid54tb1 /mnt btrfs rw,noatime,space_cache 0 0 > Ok I think I see what's going on. Can you try this patch and see if it fixes it? Thanks, Josef diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index bf6433f..84e8909 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3803,6 +3803,19 @@ static int can_overcommit(struct btrfs_root *root, return 0; } +static int btrfs_try_writeback(struct super_block *sb, unsigned long nr_pages, + enum wb_reason reason) +{ + if (!writeback_in_progress(sb->s_bdi) && + down_read_trylock(&sb->s_umount)) { + writeback_inodes_sb_nr(sb, nr_pages, reason); + up_read(&sb->s_umount); + return 1; + } + + return 0; +} + void btrfs_writeback_inodes_sb_nr(struct btrfs_root *root, unsigned long nr_pages) { @@ -3810,8 +3823,7 @@ void btrfs_writeback_inodes_sb_nr(struct btrfs_root *root, int started; /* If we can not start writeback, just sync all the delalloc file. */ - started = try_to_writeback_inodes_sb_nr(sb, nr_pages, - WB_REASON_FS_FREE_SPACE); + started = btrfs_try_writeback(sb, nr_pages, WB_REASON_FS_FREE_SPACE); if (!started) { /* * We needn't worry the filesystem going from r/w to r/o though