Re: [Ext2-devel] Re: [RFC/RFT] [PATCH] EXT3: Retry allocation after journal commit

From: Theodore Ts'o
Date: Thu May 13 2004 - 23:39:16 EST


On Thu, May 13, 2004 at 07:53:10PM -0700, Andrew Morton wrote:
> "Theodore Ts'o" <tytso@xxxxxxx> wrote:
> >
> > It is possible for block allocation to fail, even if there is space in
> > the filesystem, because all of the free blocks were recently deleted and
> > so could not be allocated until after the currently running transaction
> > is committed. This can result in a very strange and surprising result
> > where a system call such as a mkdir() will fail even though there is
> > plenty of disk space apparently available.
>
> I merged a little patch for this into post-2.6.6, but that only addresses
> prepare_write().

Oh, sorry, I didn't see that patch. The specific bug I was trying to
fix was actually in mkdir though (the regression test suite did the
equivalent of rm -rf /mntpt/*, followed by mkdir's which failed).

I can respin the patch versus BK-latest.

> I wonder if there's much value in having ext3_has_free_blocks()? We could
> just retry three times even if the fs is really full?

We could; it's an error path, after all. On the other hand, the cost
of ext3_has_free_blocks() is pretty small, and if we know that there's
no point doing the retry, why not skip the work.

> I'd be inclined to pass a pointer to the `retry' counter into
> ext3_should_retry_alloc() and implement the counting in there. It'll tidy
> things up a bit and consolidates that piece of policy in a single place.

Yes, good point.

- Ted
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/