From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-f196.google.com ([209.85.220.196]:37491 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753502AbdGUTK6 (ORCPT ); Fri, 21 Jul 2017 15:10:58 -0400 Received: by mail-qk0-f196.google.com with SMTP id q130so4937653qka.4 for ; Fri, 21 Jul 2017 12:10:58 -0700 (PDT) Date: Fri, 21 Jul 2017 15:10:56 -0400 From: Josef Bacik To: Omar Sandoval Cc: linux-btrfs@vger.kernel.org, David Sterba , Christoph Anton Mitterer , Nikolay Borisov , kernel-team@fb.com, stable@vger.kernel.org Subject: Re: [PATCH RESEND] Btrfs: fix early ENOSPC due to delalloc Message-ID: <20170721191055.GB17477@destiny> References: <33ac56aa74691de6109709168939cfe9f56cbd70.1500588286.git.osandov@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <33ac56aa74691de6109709168939cfe9f56cbd70.1500588286.git.osandov@fb.com> Sender: stable-owner@vger.kernel.org List-ID: On Thu, Jul 20, 2017 at 03:10:35PM -0700, Omar Sandoval wrote: > From: Omar Sandoval > > If a lot of metadata is reserved for outstanding delayed allocations, we > rely on shrink_delalloc() to reclaim metadata space in order to fulfill > reservation tickets. However, shrink_delalloc() has a shortcut where if > it determines that space can be overcommitted, it will stop early. This > made sense before the ticketed enospc system, but now it means that > shrink_delalloc() will often not reclaim enough space to fulfill any > tickets, leading to an early ENOSPC. (Reservation tickets don't care > about being able to overcommit, they need every byte accounted for.) > > Fix it by getting rid of the shortcut so that shrink_delalloc() reclaims > all of the metadata it is supposed to. This fixes early ENOSPCs we were > seeing when doing a btrfs receive to populate a new filesystem, as well > as early ENOSPCs Christoph saw when doing a big cp -r onto Btrfs. > > Fixes: 957780eb2788 ("Btrfs: introduce ticketed enospc infrastructure") > Tested-by: Christoph Anton Mitterer > Cc: stable@vger.kernel.org > Signed-off-by: Omar Sandoval Reviewed-by: Josef Bacik Thanks, Josef