public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Fawad Lateef <fawadlateef@gmail.com>
To: lk <linux_kernel@patni.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: alloc_page_buffers() - kernel panic?
Date: Wed, 28 Sep 2005 15:32:51 +0500	[thread overview]
Message-ID: <1e62d13705092803329ed334a@mail.gmail.com> (raw)
In-Reply-To: <002f01c5c412$194561c0$5e91a8c0@patni.com>

On 9/28/05, lk <linux_kernel@patni.com> wrote:
> I was looking at the fs(buffer.c) code, An observation:
>
> alloc_page_buffers() is called from the function create_empty_buffers() . If
> the memory allocation for the buffer head (through kmem_cache_alloc) fails
> the allocation is retried till successful for async I/O. However for
> synchronous I/O no such handling is done and create_buffer will return
> NULL which is not checked in the calling function. The pointer returned by
> NULL
> is used without checking for the NULL condition. This would result in a
> kernel panic when alloc_page_buffers() is not able to allocate buffer heads
> from the cache for sync I/O.
>

I think you overlooked alloc_page_buffers call from
create_empty_buffers .... It is called with third argument as 1 and it
is the retry argument in alloc_page_buffers function which checks
if(!retry) return NULL; so it will never return NULL if retry is 1
..........

> Is anyone aware of the thought process behind this difference in
> implementation for sync and async I/O.
>

what kind of difference ?? If its allocation of page buffers then
async IOs are not allowed to fail so it waits to allocate
memory/buffers for it ....


--
Fawad Lateef

      reply	other threads:[~2005-09-28 10:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-28  9:50 alloc_page_buffers() - kernel panic? lk
2005-09-28 10:32 ` Fawad Lateef [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=1e62d13705092803329ed334a@mail.gmail.com \
    --to=fawadlateef@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_kernel@patni.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox