diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-04-28 06:36:39 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-04-28 06:36:39 +0200 |
commit | d35cc56ddfc948d8df1aa6d41ac345fcec01854d (patch) | |
tree | 7e23a0e3dde639236e019aa88309d919941958e5 /fs/kernfs | |
parent | kobject: Make support for uevent_helper optional. (diff) | |
parent | Linux 3.15-rc3 (diff) | |
download | linux-d35cc56ddfc948d8df1aa6d41ac345fcec01854d.tar.xz linux-d35cc56ddfc948d8df1aa6d41ac345fcec01854d.zip |
Merge 3.15-rc3 into staging-next
Diffstat (limited to 'fs/kernfs')
-rw-r--r-- | fs/kernfs/dir.c | 9 | ||||
-rw-r--r-- | fs/kernfs/file.c | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 43aa97988c31..a693f5b01ae6 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -232,9 +232,6 @@ static int kernfs_link_sibling(struct kernfs_node *kn) 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; @@ -249,9 +246,15 @@ static int kernfs_link_sibling(struct kernfs_node *kn) 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; } diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c index 98bacd9ea7fd..40251cd741a0 100644 --- a/fs/kernfs/file.c +++ b/fs/kernfs/file.c @@ -485,6 +485,8 @@ static int kernfs_fop_mmap(struct file *file, struct vm_area_struct *vma) 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() |