public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lachlan McIlroy <lachlan@sgi.com>
To: Lachlan McIlroy <lachlan@sgi.com>,
	Christoph Hellwig <hch@infradead.org>,
	Mikulas Patocka <mpatocka@redhat.com>,
	linux-kernel@vger.kernel.org, xfs@oss.sgi.com
Subject: Re: spurious -ENOSPC on XFS
Date: Thu, 15 Jan 2009 11:57:08 +1100	[thread overview]
Message-ID: <496E89E4.9070004@sgi.com> (raw)
In-Reply-To: <20090114221655.GX8071@disturbed>

Dave Chinner wrote:
> On Tue, Jan 13, 2009 at 04:58:01PM +1100, Lachlan McIlroy wrote:
>> Christoph Hellwig wrote:
>>> On Mon, Jan 12, 2009 at 06:14:36AM -0500, Mikulas Patocka wrote:
>>>> Hi
>>>>
>>>> I discovered a bug in XFS in delayed allocation.
>>>>
>>>> When you take a small partition (52MB in my case) and copy many small 
>>>> files on it (source code) that barely fits there, you get -ENOSPC. 
>>>> Then sync the partition, some free space pops up, click "retry" in MC 
>>>> an the copy continues. They you get again -ENOSPC, you must sync, 
>>>> click "retry" and go on. And so on few times until the source code 
>>>> finally fits on the XFS partition.
>>>>
>>>> This misbehavior is apparently caused by delayed allocation, delayed  
>>>> allocation does not exactly know how much space will be occupied by 
>>>> data, so it makes some upper bound guess. Because free space count is 
>>>> only a guess, not the actual data being consumed, XFS should not 
>>>> return -ENOSPC on behalf of it. When the free space overflows, XFS 
>>>> should sync itself, retry allocation and only return -ENOSPC if it 
>>>> fails the second time, after the sync.
>> This sounds like a problem with speculative allocation - delayed allocations
>> beyond eof.  Even if we write a small file, say 4k, a 64k chunk of delayed
>> allocation will be credited to the file. 
> 
> The second retry occurs without speculative EOF allocation. That's
> what the BMAPI_SYNC flag does....
By then it's too late.  There could already be many files with delayed
allocations beyond eof that are unneccesarily consuming space.  I suspect
that when those files are flushed some are not able to convert the full
delayed allocation in one extent and only convert what is needed to write
out data.  The remaining unused delayed allocation is released and that's
why the freespace is going up and down.

> 
> That being said, it can't truncate away pre-existing speculative
> allocations on other files, which is why there is a global flush
> and wait before the third retry.....
> 
> Cheers,
> 
> Dave.


  reply	other threads:[~2009-01-15  0:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-12 11:14 spurious -ENOSPC on XFS Mikulas Patocka
2009-01-12 15:11 ` Christoph Hellwig
2009-01-13  5:58   ` Lachlan McIlroy
2009-01-14 22:16     ` Dave Chinner
2009-01-15  0:57       ` Lachlan McIlroy [this message]
2009-01-15  8:47         ` Dave Chinner
2009-01-13 21:49 ` Dave Chinner
2009-01-14  4:28   ` Mikulas Patocka
2009-01-18 17:31     ` Christoph Hellwig
2009-01-20 19:38       ` Mikulas Patocka
2009-01-20 23:24         ` Dave Chinner
2009-01-22 20:59           ` Christoph Hellwig
2009-01-22 22:43             ` Christoph Hellwig
2009-01-23 20:14               ` Mikulas Patocka
2009-01-24  7:12                 ` Dave Chinner
2009-01-29 16:39                   ` Mikulas Patocka
2009-01-29 16:45                     ` Mikulas Patocka
2009-01-31 23:57                     ` Dave Chinner
2009-02-02 17:36                       ` Mikulas Patocka
2009-02-03  3:27                         ` Dave Chinner
2009-02-03 20:05                           ` Mikulas Patocka
2009-02-04 12:08                             ` Dave Chinner
2009-02-05  4:31                               ` Mikulas Patocka
2009-02-05  7:43                                 ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=496E89E4.9070004@sgi.com \
    --to=lachlan@sgi.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox