All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: How to handle an kmalloc failure in evict_inode()?
Date: Mon, 4 Aug 2014 21:53:22 -0400	[thread overview]
Message-ID: <20140805015322.GC5263@thunk.org> (raw)
In-Reply-To: <20140805011356.GX26465@dastard>

On Tue, Aug 05, 2014 at 11:13:56AM +1000, Dave Chinner wrote:
> Sure, because failing to free EOF blocks on referenced inodes (i.e. link
> count > 0) is not a serious problem. i.e. freeing speculative preallocation
> beyond EOF is a best effort operation so lock inversions or memory
> allocation failure simply means we don't do it. It'll get cleaned up
> in the future (i.e. next time the inode gets pulled into cache).

I was worried about the case where the link count == 0 and
evict_inode() needs to release the inode --- and you get a memory
allocation failure.

I didn't realize that xfs's kmem_*alloc() functions uses a retry loop.
I think these days the preferred solution from the MM folks is to use
GFP_NOFAIL (although for a long time folks like David Rientjes were
trying to claim that both GFP_NOFAIL and looping was evil, and that
all kernel code had to be able to handle memory allocation failures).

As near as I can tell, in the case of evict_inode and link_count == 0,
using either GFP_NOFAIL or GFP_NOWARN and a retry loop is the only way
to deal because in the evict_inode and link_count == 0 case, failure
is simply not an option.

> Yup, that's why XFS uses __GFP_NOWARN and a retry loop - because
> there are places where failure to allocate memory can have only
> one result: denial of service via a filesystem shutdown.

Great, the next time David Rijentes whines at me, I'll direct him in
your direction, and we can flame him together.  :-)

							- Ted

  reply	other threads:[~2014-08-05  1:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04 23:41 How to handle an kmalloc failure in evict_inode()? Theodore Ts'o
2014-08-05  1:13 ` Dave Chinner
2014-08-05  1:53   ` Theodore Ts'o [this message]
2014-08-05 12:17     ` Dave Chinner
2014-08-05 17:21       ` Theodore Ts'o
2014-08-05 22:12         ` Dave Chinner
2014-08-09 10:48           ` Tetsuo Handa
2014-08-09 15:43             ` 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=20140805015322.GC5263@thunk.org \
    --to=tytso@mit.edu \
    --cc=david@fromorbit.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /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.