Merge 3.15-rc6 into driver-core-next
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 May 2014 01:13:53 +0000 (10:13 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 May 2014 01:13:53 +0000 (10:13 +0900)
We want the kernfs fixes in this branch as well for testing.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/Kconfig
fs/kernfs/dir.c
fs/kernfs/file.c
fs/kernfs/kernfs-internal.h
fs/kernfs/mount.c
include/linux/kernfs.h
include/linux/kobject.h
kernel/ksysfs.c
kernel/sysctl.c
lib/kobject_uevent.c

index 8fa8deab64492469ecdc75443aa4f67fdfb5b974..4b7b4522b64f8c36fda40c1809abc3e0a596a268 100644 (file)
@@ -1,10 +1,10 @@
 menu "Generic Driver Options"
 
-config UEVENT_HELPER_PATH
-       string "path to uevent helper"
-       default ""
+config UEVENT_HELPER
+       bool "Support for uevent helper"
+       default y
        help
-         Path to uevent helper program forked by the kernel for
+         The uevent helper program is forked by the kernel for
          every uevent.
          Before the switch to the netlink-based uevent source, this was
          used to hook hotplug scripts into kernel device events. It
@@ -15,8 +15,13 @@ config UEVENT_HELPER_PATH
          that it creates a high system load, or on smaller systems
          it is known to create out-of-memory situations during bootup.
 
-         To disable user space helper program execution at early boot
-         time specify an empty string here. This setting can be altered
+config UEVENT_HELPER_PATH
+       string "path to uevent helper"
+       depends on UEVENT_HELPER
+       default ""
+       help
+         To disable user space helper program execution at by default
+         specify an empty string here. This setting can still be altered
          via /proc/sys/kernel/hotplug or via /sys/kernel/uevent_helper
          later at runtime.
 
index ac127cd008bfeb268c5be789e339b03538d2597c..a693f5b01ae6ebdda49911cab77f8d75deb97306 100644 (file)
@@ -714,6 +714,7 @@ struct kernfs_root *kernfs_create_root(struct kernfs_syscall_ops *scops,
                return ERR_PTR(-ENOMEM);
 
        ida_init(&root->ino_ida);
+       INIT_LIST_HEAD(&root->supers);
 
        kn = __kernfs_new_node(root, "", S_IFDIR | S_IRUGO | S_IXUGO,
                               KERNFS_DIR);
index 5e9a80cfc3d8857c7cfe496eae627c921c47c6f2..e3d37f607f975dd06f6c9534b2dc929c3fa5fa21 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/poll.h>
 #include <linux/pagemap.h>
 #include <linux/sched.h>
+#include <linux/fsnotify.h>
 
 #include "kernfs-internal.h"
 
@@ -790,20 +791,48 @@ static unsigned int kernfs_fop_poll(struct file *filp, poll_table *wait)
  */
 void kernfs_notify(struct kernfs_node *kn)
 {
+       struct kernfs_root *root = kernfs_root(kn);
        struct kernfs_open_node *on;
+       struct kernfs_super_info *info;
        unsigned long flags;
 
+       if (WARN_ON(kernfs_type(kn) != KERNFS_FILE))
+               return;
+
+       /* kick poll */
        spin_lock_irqsave(&kernfs_open_node_lock, flags);
 
-       if (!WARN_ON(kernfs_type(kn) != KERNFS_FILE)) {
-               on = kn->attr.open;
-               if (on) {
-                       atomic_inc(&on->event);
-                       wake_up_interruptible(&on->poll);
-               }
+       on = kn->attr.open;
+       if (on) {
+               atomic_inc(&on->event);
+               wake_up_interruptible(&on->poll);
        }
 
        spin_unlock_irqrestore(&kernfs_open_node_lock, flags);
+
+       /* kick fsnotify */
+       mutex_lock(&kernfs_mutex);
+
+       list_for_each_entry(info, &root->supers, node) {
+               struct inode *inode;
+               struct dentry *dentry;
+
+               inode = ilookup(info->sb, kn->ino);
+               if (!inode)
+                       continue;
+
+               dentry = d_find_any_alias(inode);
+               if (dentry) {
+                       fsnotify_parent(NULL, dentry, FS_MODIFY);
+                       fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE,
+                                NULL, 0);
+                       dput(dentry);
+               }
+
+               iput(inode);
+       }
+
+       mutex_unlock(&kernfs_mutex);
 }
 EXPORT_SYMBOL_GPL(kernfs_notify);
 
index 8be13b2a079ba214e5d37373b20fd7afc5c7b94d..dc84a3ef9ca20420ff29c691abfa8436395ed993 100644 (file)
@@ -49,6 +49,8 @@ static inline struct kernfs_root *kernfs_root(struct kernfs_node *kn)
  * mount.c
  */
 struct kernfs_super_info {
+       struct super_block      *sb;
+
        /*
         * The root associated with this super_block.  Each super_block is
         * identified by the root and ns it's associated with.
@@ -62,6 +64,9 @@ struct kernfs_super_info {
         * an array and compare kernfs_node tag against every entry.
         */
        const void              *ns;
+
+       /* anchored at kernfs_root->supers, protected by kernfs_mutex */
+       struct list_head        node;
 };
 #define kernfs_info(SB) ((struct kernfs_super_info *)(SB->s_fs_info))
 
index 6a5f04ac87040d85179420d254d528789ddcf1d6..f25a7c0c3cdc317c6dbd34b9b7559b24ed3444cc 100644 (file)
@@ -68,6 +68,7 @@ static int kernfs_fill_super(struct super_block *sb)
        struct inode *inode;
        struct dentry *root;
 
+       info->sb = sb;
        sb->s_blocksize = PAGE_CACHE_SIZE;
        sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
        sb->s_magic = SYSFS_MAGIC;
@@ -166,12 +167,18 @@ struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags,
                *new_sb_created = !sb->s_root;
 
        if (!sb->s_root) {
+               struct kernfs_super_info *info = kernfs_info(sb);
+
                error = kernfs_fill_super(sb);
                if (error) {
                        deactivate_locked_super(sb);
                        return ERR_PTR(error);
                }
                sb->s_flags |= MS_ACTIVE;
+
+               mutex_lock(&kernfs_mutex);
+               list_add(&info->node, &root->supers);
+               mutex_unlock(&kernfs_mutex);
        }
 
        return dget(sb->s_root);
@@ -190,6 +197,10 @@ void kernfs_kill_sb(struct super_block *sb)
        struct kernfs_super_info *info = kernfs_info(sb);
        struct kernfs_node *root_kn = sb->s_root->d_fsdata;
 
+       mutex_lock(&kernfs_mutex);
+       list_del(&info->node);
+       mutex_unlock(&kernfs_mutex);
+
        /*
         * Remove the superblock from fs_supers/s_instances
         * so we can't find it, before freeing kernfs_super_info.
index ca1be5c9136c4557de511143b4c9b36e1eec3734..c841688a78a3b166919135152f247a0cfc2fbb81 100644 (file)
@@ -161,6 +161,10 @@ struct kernfs_root {
        /* private fields, do not use outside kernfs proper */
        struct ida              ino_ida;
        struct kernfs_syscall_ops *syscall_ops;
+
+       /* list of kernfs_super_info of this root, protected by kernfs_mutex */
+       struct list_head        supers;
+
        wait_queue_head_t       deactivate_waitq;
 };
 
index f896a33e8341e1e281ad6b19f5d75da0c4d70622..2d61b909f414f6f61e37ca9c53372d85392242fd 100644 (file)
 #define UEVENT_NUM_ENVP                        32      /* number of env pointers */
 #define UEVENT_BUFFER_SIZE             2048    /* buffer for the variables */
 
+#ifdef CONFIG_UEVENT_HELPER
 /* path to the userspace helper executed on an event */
 extern char uevent_helper[];
+#endif
 
 /* counter to tag the uevent, read only except for the kobject core */
 extern u64 uevent_seqnum;
index 2495a9b14ac8f1ffa67722de3bd410c6493d42e5..6683ccef9fffb2de28b6a4d6d01393b080811d6a 100644 (file)
@@ -37,6 +37,7 @@ static ssize_t uevent_seqnum_show(struct kobject *kobj,
 }
 KERNEL_ATTR_RO(uevent_seqnum);
 
+#ifdef CONFIG_UEVENT_HELPER
 /* uevent helper program, used during early boot */
 static ssize_t uevent_helper_show(struct kobject *kobj,
                                  struct kobj_attribute *attr, char *buf)
@@ -56,7 +57,7 @@ static ssize_t uevent_helper_store(struct kobject *kobj,
        return count;
 }
 KERNEL_ATTR_RW(uevent_helper);
-
+#endif
 
 #ifdef CONFIG_PROFILING
 static ssize_t profiling_show(struct kobject *kobj,
@@ -189,7 +190,9 @@ EXPORT_SYMBOL_GPL(kernel_kobj);
 static struct attribute * kernel_attrs[] = {
        &fscaps_attr.attr,
        &uevent_seqnum_attr.attr,
+#ifdef CONFIG_UEVENT_HELPER
        &uevent_helper_attr.attr,
+#endif
 #ifdef CONFIG_PROFILING
        &profiling_attr.attr,
 #endif
index 74f5b580fe34904fa4d9bcb2790545a323367773..bc966a8ffc3e442bb975be79fecaa255a85f7b8a 100644 (file)
@@ -643,7 +643,7 @@ static struct ctl_table kern_table[] = {
                .extra2         = &one,
        },
 #endif
-
+#ifdef CONFIG_UEVENT_HELPER
        {
                .procname       = "hotplug",
                .data           = &uevent_helper,
@@ -651,7 +651,7 @@ static struct ctl_table kern_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_dostring,
        },
-
+#endif
 #ifdef CONFIG_CHR_DEV_SG
        {
                .procname       = "sg-big-buff",
index 4e3bd71bd9495cfbf95fd9a28adf5e18a71f4592..9ebf9e20de53db9aa62d9c3d7cd8764a8adee617 100644 (file)
@@ -29,7 +29,9 @@
 
 
 u64 uevent_seqnum;
+#ifdef CONFIG_UEVENT_HELPER
 char uevent_helper[UEVENT_HELPER_PATH_LEN] = CONFIG_UEVENT_HELPER_PATH;
+#endif
 #ifdef CONFIG_NET
 struct uevent_sock {
        struct list_head list;
@@ -109,6 +111,7 @@ static int kobj_bcast_filter(struct sock *dsk, struct sk_buff *skb, void *data)
 }
 #endif
 
+#ifdef CONFIG_UEVENT_HELPER
 static int kobj_usermode_filter(struct kobject *kobj)
 {
        const struct kobj_ns_type_operations *ops;
@@ -147,6 +150,7 @@ static void cleanup_uevent_env(struct subprocess_info *info)
 {
        kfree(info->data);
 }
+#endif
 
 /**
  * kobject_uevent_env - send an uevent with environmental data
@@ -323,6 +327,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
 #endif
        mutex_unlock(&uevent_sock_mutex);
 
+#ifdef CONFIG_UEVENT_HELPER
        /* call uevent_helper, usually only enabled during early boot */
        if (uevent_helper[0] && !kobj_usermode_filter(kobj)) {
                struct subprocess_info *info;
@@ -347,6 +352,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
                        env = NULL;     /* freed by cleanup_uevent_env */
                }
        }
+#endif
 
 exit:
        kfree(devpath);
This page took 0.03763 seconds and 5 git commands to generate.