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: Thu, 27 Jun 2013 13:36:52 -0400 [thread overview]
Message-ID: <20130627173652.GA22107@thunk.org> (raw)
In-Reply-To: <CAFy9=U5bPbDqfU=NVdaxvK5gNX9O33LD6mYJYqoTQLq7UTjqFw@mail.gmail.com>
On Thu, Jun 27, 2013 at 06:28:21PM +0530, Nagachandra P wrote:
> Hi Theodore,
>
> Could you point me to the code where ext4_std_err is not triggered
> because of LMK? As I see it, if a memory allocation returns error in
> some of the case ext4_std_error would invariably be called. Please
> consider the following call stack
Yes, that's one example where a memory allocation failure can lead to
ext4_std_error() getting called, and I've already acknowledged that's
one that we need to fix (although as I said, fixing it may be tricky,
short of calling congestion_wait() and then retrying the allocation,
and hoping that in the meantime the OOM killer has freed up some
memory).
If you'd could give me a list of other memory allocations where
ext4_std_error() could get called, please let me know. Note that in
the jbd2 layer, though, we handle a memory allocation failure by
retrying the allocation, to avoid this the file system getting marked
read/only. Examples of this include in jbd2_journal_write_metadata_buffer(),
and in jbd2_journal_add_journal_head() when it calls
journal_alloc_journal_head(). (Although the way we're doing the retry
in the latter case is a bit ugly and we're not sleeping with a call to
congestion_wait(), so it's something we should clean up.)
To give you an example of the intended use of ext4_std_error(), if the
journal commit code runs into a disk I/O error while writing to the
journal, the jbd2 code has to mark the journal as aborted. This could
happen because the disk has gone off-line, or the HDD has run out of
spare disk sectors in its bad block replacement pool, so it has to
return a write error to the OS. Once the journal has been marked as
aborted, the next time the ext4 code tries to access the journal, by
starting a new journal handle, or marking a metadata block dirty, the
jbd2 function will return an error, and this will cause
ext4_std_error() to be called so the file system can be marked as
requiring a file system check.
Regards,
- Ted
next prev parent reply other threads:[~2013-06-27 17:36 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 [this message]
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=20130627173652.GA22107@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.