* udev loops eating 100 % CPU [mmotm 2010-05-21-16-05]
@ 2010-05-25 12:12 Jiri Slaby
2010-05-25 12:22 ` Eric Paris
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Slaby @ 2010-05-25 12:12 UTC (permalink / raw)
To: Eric Paris
Cc: Al Viro, Kay Sievers, Linux kernel mailing list, linux-fsdevel,
Andrew Morton
Hi,
>From next/master:
commit a7cf4145bb86aaf85d4d4d29a69b50b688e2e49d
Author: Eric Paris <eparis@redhat.com>
Date: Fri May 14 11:44:10 2010 -0400
anon_inode: set S_IFREG on the anon_inode
anon_inode_mkinode() sets inode->i_mode = S_IRUSR | S_IWUSR; This means
that (inode->i_mode & S_IFMT) == 0. This trips up some SELinux code
that
needs to determine if a given inode is a regular file, a directory, etc.
The easiest solution is to just make sure that the anon_inode also sets
S_IFREG.
Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
causes my udev and psi both eating 100 % CPU. When I revert that on the
top of mmotm 2010-05-21-16-05, the problem disappears.
These are red-numbered lines from perf:
13.96% udevd [kernel.kallsyms] [k] _raw_spin_unlock_irqrestore
10.22% udevd [kernel.kallsyms] [k] signalfd_poll
7.82% udevd [kernel.kallsyms] [k] system_call_after_swapgs
6.33% udevd [kernel.kallsyms] [k] do_sys_poll
5.43% udevd udevd [.] 0x0000000000dc72
It loops with this strace:
ioctl(7, FIONREAD, [0]) = 0
poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=7,
events=POLLIN}, {fd=8, events=POLLIN}, {fd=9, events=POLLIN}], 5, 3000)
= 1 ([{fd=7, revents=POLLIN}])
where /proc/.../fd is:
lrwx------ 1 root root 64 May 25 14:06 0 -> /dev/null
lrwx------ 1 root root 64 May 25 14:06 1 -> /dev/null
lrwx------ 1 root root 64 May 25 14:06 10 -> socket:[1676]
lrwx------ 1 root root 64 May 25 14:06 2 -> /dev/null
lrwx------ 1 root root 64 May 25 14:06 3 -> /dev/.udev/queue.bin
lrwx------ 1 root root 64 May 25 14:06 4 -> socket:[1673]
l-wx------ 1 root root 64 May 25 14:06 5 -> /dev/blog
lrwx------ 1 root root 64 May 25 14:06 6 -> socket:[1674]
lr-x------ 1 root root 64 May 25 14:06 7 -> anon_inode:inotify
lrwx------ 1 root root 64 May 25 14:06 8 -> anon_inode:[signalfd]
lrwx------ 1 root root 64 May 25 14:06 9 -> socket:[1675]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: udev loops eating 100 % CPU [mmotm 2010-05-21-16-05]
2010-05-25 12:12 udev loops eating 100 % CPU [mmotm 2010-05-21-16-05] Jiri Slaby
@ 2010-05-25 12:22 ` Eric Paris
2010-05-25 12:28 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Eric Paris @ 2010-05-25 12:22 UTC (permalink / raw)
To: Jiri Slaby
Cc: Al Viro, Kay Sievers, Linux kernel mailing list, linux-fsdevel,
Andrew Morton
On Tue, 2010-05-25 at 14:12 +0200, Jiri Slaby wrote:
thanks for the report, it's a known problem:
http://lkml.org/lkml/2010/5/22/150
Not sure yet how we are going to fix it. You can either just revert or
you could run this patch which I am using on my box. Not sure which Al
is going to want to do......
commit 6e066d6c0c70e2032b5fd2b5c6375e66a0f547f9
Author: Eric Paris <eparis@redhat.com>
Date: Tue May 25 07:55:46 2010 -0400
anon_inode/ioctl: push FIONREAD for anon_inode to the file handler
FIONREAD for all S_IFREG files is handled by file_ioctl but the
anon_inode_inode is a magic special beast since the inode is shared between
lots of users. Thus ioctl calls on anon_inode_inode needs to go through
vfs_inode() instead of trying to shortcut some calls through file_ioctl().
Signed-off-by: Eric Paris <eparis@redhat.com>
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index 9bd4b38..4ae8c6b 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -23,7 +23,7 @@
#include <asm/uaccess.h>
static struct vfsmount *anon_inode_mnt __read_mostly;
-static struct inode *anon_inode_inode;
+struct inode *anon_inode_inode;
static const struct file_operations anon_inode_fops;
static int anon_inodefs_get_sb(struct file_system_type *fs_type, int flags,
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 2d140a7..7041855 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -14,6 +14,7 @@
#include <linux/module.h>
#include <linux/uaccess.h>
#include <linux/writeback.h>
+#include <linux/anon_inodes.h>
#include <linux/buffer_head.h>
#include <linux/falloc.h>
@@ -601,7 +602,8 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
}
default:
- if (S_ISREG(filp->f_path.dentry->d_inode->i_mode))
+ if (S_ISREG(filp->f_path.dentry->d_inode->i_mode) &&
+ (filp->f_path.dentry->d_inode != anon_inode_inode))
error = file_ioctl(filp, cmd, arg);
else
error = vfs_ioctl(filp, cmd, arg);
diff --git a/include/linux/anon_inodes.h b/include/linux/anon_inodes.h
index 69a21e0..ebfece0 100644
--- a/include/linux/anon_inodes.h
+++ b/include/linux/anon_inodes.h
@@ -8,6 +8,8 @@
#ifndef _LINUX_ANON_INODES_H
#define _LINUX_ANON_INODES_H
+extern struct inode *anon_inode_inode;
+
struct file *anon_inode_getfile(const char *name,
const struct file_operations *fops,
void *priv, int flags);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: udev loops eating 100 % CPU [mmotm 2010-05-21-16-05]
2010-05-25 12:22 ` Eric Paris
@ 2010-05-25 12:28 ` Christoph Hellwig
0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2010-05-25 12:28 UTC (permalink / raw)
To: Eric Paris
Cc: Jiri Slaby, Al Viro, Kay Sievers, Linux kernel mailing list,
linux-fsdevel, Andrew Morton
On Tue, May 25, 2010 at 08:22:12AM -0400, Eric Paris wrote:
> On Tue, 2010-05-25 at 14:12 +0200, Jiri Slaby wrote:
>
> thanks for the report, it's a known problem:
>
> http://lkml.org/lkml/2010/5/22/150
>
> Not sure yet how we are going to fix it. You can either just revert or
> you could run this patch which I am using on my box. Not sure which Al
> is going to want to do......
>
> commit 6e066d6c0c70e2032b5fd2b5c6375e66a0f547f9
> Author: Eric Paris <eparis@redhat.com>
> Date: Tue May 25 07:55:46 2010 -0400
>
> anon_inode/ioctl: push FIONREAD for anon_inode to the file handler
>
> FIONREAD for all S_IFREG files is handled by file_ioctl but the
> anon_inode_inode is a magic special beast since the inode is shared between
> lots of users. Thus ioctl calls on anon_inode_inode needs to go through
> vfs_inode() instead of trying to shortcut some calls through file_ioctl().
>
> Signed-off-by: Eric Paris <eparis@redhat.com>
This one is defintively far too disgusting.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-25 12:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-25 12:12 udev loops eating 100 % CPU [mmotm 2010-05-21-16-05] Jiri Slaby
2010-05-25 12:22 ` Eric Paris
2010-05-25 12:28 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).