From: Andrew Morton <akpm@digeo.com>
To: Rebecca.Callan@ir.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: decrement of inodes_stat.nr_inodes in inode.c not SMP safe?
Date: Tue, 19 Nov 2002 21:42:52 -0800 [thread overview]
Message-ID: <3DDB20DC.7C8BE115@digeo.com> (raw)
In-Reply-To: 694BB7191495D51183A9005004C0B05482D50E@ir-exchange-srv.ir.com.au
Rebecca.Callan@ir.com wrote:
>
> The value for nr_inodes in /proc/sys/fs/inode-state appears to be wrong.
>
> I think this is probably a bug in all 2.4 smp kernels. I've seen it in
> 2.4.8-26mdksmp and 2.4.18-3smp.
>
Is true. The 2.5 change needs to be backported.
--- linux-akpm/fs/inode.c~inodes_stat-race Tue Nov 19 21:42:08 2002
+++ linux-akpm-akpm/fs/inode.c Tue Nov 19 21:42:23 2002
@@ -532,22 +532,25 @@ void clear_inode(struct inode *inode)
* Dispose-list gets a local list with local inodes in it, so it doesn't
* need to worry about list corruption and SMP locks.
*/
-static void dispose_list(struct list_head * head)
+static void dispose_list(struct list_head *head)
{
- struct list_head * inode_entry;
- struct inode * inode;
+ int nr_disposed = 0;
- while ((inode_entry = head->next) != head)
- {
- list_del(inode_entry);
+ while (!list_empty(head)) {
+ struct inode *inode;
+
+ inode = list_entry(head->next, struct inode, i_list);
+ list_del(&inode->i_list);
- inode = list_entry(inode_entry, struct inode, i_list);
if (inode->i_data.nrpages)
truncate_inode_pages(&inode->i_data, 0);
clear_inode(inode);
destroy_inode(inode);
- inodes_stat.nr_inodes--;
+ nr_disposed++;
}
+ spin_lock(&inode_lock);
+ inodes_stat.nr_inodes -= nr_disposed;
+ spin_unlock(&inode_lock);
}
/*
_
prev parent reply other threads:[~2002-11-20 5:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-20 5:07 decrement of inodes_stat.nr_inodes in inode.c not SMP safe? Rebecca.Callan
2002-11-20 5:42 ` Andrew Morton [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=3DDB20DC.7C8BE115@digeo.com \
--to=akpm@digeo.com \
--cc=Rebecca.Callan@ir.com \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox