From: Andrew Morton <akpm@osdl.org>
To: Martin Devera <devik@cdi.cz>
Cc: linux-kernel@vger.kernel.org
Subject: Re: stat of /proc fails after CPU hot-unplug with EOVERFLOW in 2.6.18
Date: Wed, 27 Sep 2006 01:13:48 -0700 [thread overview]
Message-ID: <20060927011348.36818f83.akpm@osdl.org> (raw)
In-Reply-To: <451A2E83.5000806@cdi.cz>
On Wed, 27 Sep 2006 09:55:47 +0200
Martin Devera <devik@cdi.cz> wrote:
> Hello,
>
> I have 2way Opteron machine. I've done this:
> echo 0 > /sys/devices/system/cpu/cpu1/online
>
> and then strace stat /proc:
>
> [snip]
> personality(PER_LINUX) = 4194304
> getpid() = 14926
> brk(0) = 0x804b000
> brk(0x804b1a0) = 0x804b1a0
> brk(0x804c000) = 0x804c000
> stat("/proc", 0xbf8e7490) = -1 EOVERFLOW
>
> When I do echo 1 > ... to start cpu again then the stat starts
> to work again ... Weird.
>
boggle.
Can you add this patch, see where it's going bad?
fs/stat.c | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
diff -puN fs/stat.c~a fs/stat.c
--- a/fs/stat.c~a
+++ a/fs/stat.c
@@ -18,6 +18,8 @@
#include <asm/uaccess.h>
#include <asm/unistd.h>
+#define D() printk("%s:%d\n", __FILE__, __LINE__)
+
void generic_fillattr(struct inode *inode, struct kstat *stat)
{
stat->dev = inode->i_sb->s_dev;
@@ -141,14 +143,18 @@ static int cp_old_stat(struct kstat *sta
tmp.st_ino = stat->ino;
tmp.st_mode = stat->mode;
tmp.st_nlink = stat->nlink;
- if (tmp.st_nlink != stat->nlink)
+ if (tmp.st_nlink != stat->nlink) {
+ D();
return -EOVERFLOW;
+ }
SET_UID(tmp.st_uid, stat->uid);
SET_GID(tmp.st_gid, stat->gid);
tmp.st_rdev = old_encode_dev(stat->rdev);
#if BITS_PER_LONG == 32
- if (stat->size > MAX_NON_LFS)
+ if (stat->size > MAX_NON_LFS) {
+ D();
return -EOVERFLOW;
+ }
#endif
tmp.st_size = stat->size;
tmp.st_atime = stat->atime.tv_sec;
@@ -195,11 +201,15 @@ static int cp_new_stat(struct kstat *sta
struct stat tmp;
#if BITS_PER_LONG == 32
- if (!old_valid_dev(stat->dev) || !old_valid_dev(stat->rdev))
+ if (!old_valid_dev(stat->dev) || !old_valid_dev(stat->rdev)) {
+ D();
return -EOVERFLOW;
+ }
#else
- if (!new_valid_dev(stat->dev) || !new_valid_dev(stat->rdev))
+ if (!new_valid_dev(stat->dev) || !new_valid_dev(stat->rdev)) {
+ D();
return -EOVERFLOW;
+ }
#endif
memset(&tmp, 0, sizeof(tmp));
@@ -211,8 +221,10 @@ static int cp_new_stat(struct kstat *sta
tmp.st_ino = stat->ino;
tmp.st_mode = stat->mode;
tmp.st_nlink = stat->nlink;
- if (tmp.st_nlink != stat->nlink)
+ if (tmp.st_nlink != stat->nlink) {
+ D();
return -EOVERFLOW;
+ }
SET_UID(tmp.st_uid, stat->uid);
SET_GID(tmp.st_gid, stat->gid);
#if BITS_PER_LONG == 32
@@ -221,8 +233,10 @@ static int cp_new_stat(struct kstat *sta
tmp.st_rdev = new_encode_dev(stat->rdev);
#endif
#if BITS_PER_LONG == 32
- if (stat->size > MAX_NON_LFS)
+ if (stat->size > MAX_NON_LFS) {
+ D();
return -EOVERFLOW;
+ }
#endif
tmp.st_size = stat->size;
tmp.st_atime = stat->atime.tv_sec;
@@ -337,8 +351,10 @@ static long cp_new_stat64(struct kstat *
memset(&tmp, 0, sizeof(struct stat64));
#ifdef CONFIG_MIPS
/* mips has weird padding, so we don't get 64 bits there */
- if (!new_valid_dev(stat->dev) || !new_valid_dev(stat->rdev))
+ if (!new_valid_dev(stat->dev) || !new_valid_dev(stat->rdev)) {
+ D();
return -EOVERFLOW;
+ }
tmp.st_dev = new_encode_dev(stat->dev);
tmp.st_rdev = new_encode_dev(stat->rdev);
#else
_
next prev parent reply other threads:[~2006-09-27 8:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-27 7:55 Martin Devera
2006-09-27 8:13 ` Andrew Morton [this message]
2006-09-27 14:44 ` Martin Devera
2006-10-03 8:40 ` Martin Devera
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=20060927011348.36818f83.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=devik@cdi.cz \
--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
Powered by JetHome