All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Nagachandra P <nagachandra@gmail.com>
Cc: 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 10:54:17 -0400	[thread overview]
Message-ID: <20130626145417.GB32092@thunk.org> (raw)
In-Reply-To: <20130626140205.GE3875@thunk.org>

On Wed, Jun 26, 2013 at 10:02:05AM -0400, Theodore Ts'o wrote:
> 
> In this particular case, we could reflect the error all the way up to
> the ftruncate(2) system call.  Fixing this is going to be a bit
> involved, unfortunately; we'll need to update a fairly large number of
> function signatures, including ext4_truncate(), ext4_ext_truncate(),
> ext4_free_blocks(), and a number of others.

One thing that comes to mind.  If we change things so that ftruncate
reflects an ENOMEM error all the way up to userspace, one side effect
of this is that the file may be partially truncated when ENOMEM is
returned.  Applications may not be prepared for this.

There would be a similar issue if we do the truncate in the unlink
call and return ENOMEM in case of a failure, the file might not be
unlinked, and in fact we might have a partially truncated file in the
directory, which would probably cause all sorts of confusion.  So
we're probably better off, putting the inode on a list of inodes in
memory, and on the orphan list on disk, and then retry the truncation
when memory is available.  Messy, but that probably gives the best
result for applications living constantly in high memory pressure
environments.

							- Ted

  reply	other threads:[~2013-06-26 14:54 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 [this message]
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

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=20130626145417.GB32092@thunk.org \
    --to=tytso@mit.edu \
    --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.