mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ram Gupta" <ram.gupta5@gmail.com>
To: "Andrew Morton" <akpm@osdl.org>
Cc: "linux mailing-list" <linux-kernel@vger.kernel.org>,
	torvalds@linux-foundation.org
Subject: [PATCH]fs: Fix to correct the mbcache entries counter
Date: Thu, 25 Oct 2007 10:03:28 -0500	[thread overview]
Message-ID: <728201270710250803p72c656d1nca58ad0bf4f91d41@mail.gmail.com> (raw)

This patch fixes the c_entry_count counter of the mbcache. Currently
it increments the counter first & allocate the cache entry later. In
case of failure to allocate the entry due to insufficient memory this
counter is still left incremented. This patch fixes this anomaly.

Signed-off-by: Ram Gupta <ram.gupta5@gmail.com>
---------------
--- linux-2.6.23.1/fs/mbcache.c.orig    2007-10-25 09:19:28.000000000 -0500
+++ linux-2.6.23.1/fs/mbcache.c 2007-10-25 09:19:59.000000000 -0500
@@ -403,9 +403,9 @@ mb_cache_entry_alloc(struct mb_cache *ca
 {
        struct mb_cache_entry *ce;

-       atomic_inc(&cache->c_entry_count);
        ce = kmem_cache_alloc(cache->c_entry_cache, GFP_KERNEL);
        if (ce) {
+               atomic_inc(&cache->c_entry_count);
                INIT_LIST_HEAD(&ce->e_lru_list);
                INIT_LIST_HEAD(&ce->e_block_list);
                ce->e_cache = cache;

Thanks
Ram Gupta

                 reply	other threads:[~2007-10-25 15:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=728201270710250803p72c656d1nca58ad0bf4f91d41@mail.gmail.com \
    --to=ram.gupta5@gmail.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®