]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Merge 3.15-rc3 into staging-next
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Apr 2014 04:36:39 +0000 (21:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Apr 2014 04:36:39 +0000 (21:36 -0700)
1  2 
fs/kernfs/dir.c
fs/kernfs/file.c

diff --combined fs/kernfs/dir.c
index 43aa97988c31ccb3dcb52f376d223227294f24d2,ac127cd008bfeb268c5be789e339b03538d2597c..a693f5b01ae6ebdda49911cab77f8d75deb97306
@@@ -232,9 -232,6 +232,6 @@@ static int kernfs_link_sibling(struct k
        struct rb_node **node = &kn->parent->dir.children.rb_node;
        struct rb_node *parent = NULL;
  
-       if (kernfs_type(kn) == KERNFS_DIR)
-               kn->parent->dir.subdirs++;
        while (*node) {
                struct kernfs_node *pos;
                int result;
                else
                        return -EEXIST;
        }
        /* add new node and rebalance the tree */
        rb_link_node(&kn->rb, parent, node);
        rb_insert_color(&kn->rb, &kn->parent->dir.children);
+       /* successfully added, account subdir number */
+       if (kernfs_type(kn) == KERNFS_DIR)
+               kn->parent->dir.subdirs++;
        return 0;
  }
  
@@@ -711,7 -714,6 +714,7 @@@ struct kernfs_root *kernfs_create_root(
                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);
diff --combined fs/kernfs/file.c
index 98bacd9ea7fdbac808dbe75d359ab1602c193d92,e01ea4a14a014b3123dddf6d2ad1ecb9a6381736..40251cd741a0835835d8565f7f855c2db0321576
@@@ -14,7 -14,6 +14,7 @@@
  #include <linux/poll.h>
  #include <linux/pagemap.h>
  #include <linux/sched.h>
 +#include <linux/fsnotify.h>
  
  #include "kernfs-internal.h"
  
@@@ -485,6 -484,8 +485,8 @@@ static int kernfs_fop_mmap(struct file 
  
        ops = kernfs_ops(of->kn);
        rc = ops->mmap(of, vma);
+       if (rc)
+               goto out_put;
  
        /*
         * PowerPC's pci_mmap of legacy_mem uses shmem_zero_setup()
@@@ -786,48 -787,20 +788,48 @@@ static unsigned int kernfs_fop_poll(str
   */
  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);