All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: "Joseph D. Wagner" <joe@josephdwagner.info>
Cc: Nagachandra P <nagachandra@gmail.com>,
	Vikram MP <mp.vikram@gmail.com>,
	linux-ext4@vger.kernel.org
Subject: Re: Memory allocation can cause ext4 filesystem to be remounted r/o
Date: Wed, 26 Jun 2013 18:14:22 -0400	[thread overview]
Message-ID: <20130626221422.GC4128@thunk.org> (raw)
In-Reply-To: <49ee4e84554c82d944d092fe2ec8ce82@josephdwagner.info>

On Wed, Jun 26, 2013 at 11:53:12AM -0700, Joseph D. Wagner wrote:
>  1. Does not guarantee that memory will be available when ext4 needs
>     its.  Memory might be available during this pre-check, but another
>     process might scoop it up between the pre-check and ext4's
>     allocation.

This is the huge one.  In some cases we might need to read potentially
one or more disk blocks in the course of servicing the request.  By
the time we've read in the disk blocks, hundreds of milliseconds can
have gone by.  If there is a high speed network transfer coming in
over the network, the networking stack can chew up a huge amount of
memory surprisingly quickly (to say nothing of a JVM that might be
starting up in parallel with reading in the allocation bitmaps, for
example).

This is also assuming we know in advance how much memory would be
needed.  Depending on how fragmented a file might be, the amount of
memory required can vary significantly.  And if the required metadata
blocks are in memory, we won't know how much memory will be needed
until we pull the necessary blocks into memory.

The other problem with doing this is that the point at which we would
do the check for the necessary memory is at the high-level portions of
the ext4, and the places where we are doing the memory allocation are
sometimes deep in the guts of ext4.  So figuring this out would
require some truly nasty abstraction violations.  For the same reason,
we can't just simply allocate the memory before we start the
file system operation.

There are places where we could do this, without doing severe violence
to the surrounding code and without making things a total maintenance
nightmare.  But it's one of those things where we'd have to look at
each place where we allocate memory and decide what's the best way to
handle things.

							- Ted

      reply	other threads:[~2013-06-26 22:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-25  9:25 (unknown), Nagachandra P
2013-06-26 14:02 ` Memory allocation can cause ext4 filesystem to be remounted r/o Theodore Ts'o
2013-06-26 14:54   ` Theodore Ts'o
2013-06-26 15:20     ` Nagachandra P
2013-06-26 16:34       ` Theodore Ts'o
2013-06-26 17:05         ` Nagachandra P
2013-06-26 18:03           ` Theodore Ts'o
2013-06-27 12:58             ` Nagachandra P
2013-06-27 17:36               ` Theodore Ts'o
2013-06-28 13:52                 ` Nagachandra P
2013-06-26 18:53     ` Joseph D. Wagner
2013-06-26 22:14       ` Theodore Ts'o [this message]

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=20130626221422.GC4128@thunk.org \
    --to=tytso@mit.edu \
    --cc=joe@josephdwagner.info \
    --cc=linux-ext4@vger.kernel.org \
    --cc=mp.vikram@gmail.com \
    --cc=nagachandra@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.