diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/debugfs/inode.c | 2 | ||||
-rw-r--r-- | fs/namei.c | 8 | ||||
-rw-r--r-- | fs/notify/inotify/inotify_user.c | 59 |
3 files changed, 10 insertions, 59 deletions
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 274ac865bae8..049d6c36da09 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -496,7 +496,7 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, | |||
496 | } | 496 | } |
497 | d_move(old_dentry, dentry); | 497 | d_move(old_dentry, dentry); |
498 | fsnotify_move(old_dir->d_inode, new_dir->d_inode, old_name, | 498 | fsnotify_move(old_dir->d_inode, new_dir->d_inode, old_name, |
499 | old_dentry->d_name.name, S_ISDIR(old_dentry->d_inode->i_mode), | 499 | S_ISDIR(old_dentry->d_inode->i_mode), |
500 | NULL, old_dentry); | 500 | NULL, old_dentry); |
501 | fsnotify_oldname_free(old_name); | 501 | fsnotify_oldname_free(old_name); |
502 | unlock_rename(new_dir, old_dir); | 502 | unlock_rename(new_dir, old_dir); |
diff --git a/fs/namei.c b/fs/namei.c index 54d33df06be0..0741c69b3319 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1334,7 +1334,7 @@ static int may_delete(struct inode *dir,struct dentry *victim,int isdir) | |||
1334 | return -ENOENT; | 1334 | return -ENOENT; |
1335 | 1335 | ||
1336 | BUG_ON(victim->d_parent->d_inode != dir); | 1336 | BUG_ON(victim->d_parent->d_inode != dir); |
1337 | audit_inode_child(victim->d_name.name, victim, dir); | 1337 | audit_inode_child(victim, dir); |
1338 | 1338 | ||
1339 | error = inode_permission(dir, MAY_WRITE | MAY_EXEC); | 1339 | error = inode_permission(dir, MAY_WRITE | MAY_EXEC); |
1340 | if (error) | 1340 | if (error) |
@@ -2663,11 +2663,9 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
2663 | error = vfs_rename_dir(old_dir,old_dentry,new_dir,new_dentry); | 2663 | error = vfs_rename_dir(old_dir,old_dentry,new_dir,new_dentry); |
2664 | else | 2664 | else |
2665 | error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry); | 2665 | error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry); |
2666 | if (!error) { | 2666 | if (!error) |
2667 | const char *new_name = old_dentry->d_name.name; | 2667 | fsnotify_move(old_dir, new_dir, old_name, is_dir, |
2668 | fsnotify_move(old_dir, new_dir, old_name, new_name, is_dir, | ||
2669 | new_dentry->d_inode, old_dentry); | 2668 | new_dentry->d_inode, old_dentry); |
2670 | } | ||
2671 | fsnotify_oldname_free(old_name); | 2669 | fsnotify_oldname_free(old_name); |
2672 | 2670 | ||
2673 | return error; | 2671 | return error; |
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index a94e8bd8eb1f..472cdf29ef82 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c | |||
@@ -29,14 +29,12 @@ | |||
29 | #include <linux/init.h> /* module_init */ | 29 | #include <linux/init.h> /* module_init */ |
30 | #include <linux/inotify.h> | 30 | #include <linux/inotify.h> |
31 | #include <linux/kernel.h> /* roundup() */ | 31 | #include <linux/kernel.h> /* roundup() */ |
32 | #include <linux/magic.h> /* superblock magic number */ | ||
33 | #include <linux/mount.h> /* mntget */ | ||
34 | #include <linux/namei.h> /* LOOKUP_FOLLOW */ | 32 | #include <linux/namei.h> /* LOOKUP_FOLLOW */ |
35 | #include <linux/path.h> /* struct path */ | ||
36 | #include <linux/sched.h> /* struct user */ | 33 | #include <linux/sched.h> /* struct user */ |
37 | #include <linux/slab.h> /* struct kmem_cache */ | 34 | #include <linux/slab.h> /* struct kmem_cache */ |
38 | #include <linux/syscalls.h> | 35 | #include <linux/syscalls.h> |
39 | #include <linux/types.h> | 36 | #include <linux/types.h> |
37 | #include <linux/anon_inodes.h> | ||
40 | #include <linux/uaccess.h> | 38 | #include <linux/uaccess.h> |
41 | #include <linux/poll.h> | 39 | #include <linux/poll.h> |
42 | #include <linux/wait.h> | 40 | #include <linux/wait.h> |
@@ -45,8 +43,6 @@ | |||
45 | 43 | ||
46 | #include <asm/ioctls.h> | 44 | #include <asm/ioctls.h> |
47 | 45 | ||
48 | static struct vfsmount *inotify_mnt __read_mostly; | ||
49 | |||
50 | /* these are configurable via /proc/sys/fs/inotify/ */ | 46 | /* these are configurable via /proc/sys/fs/inotify/ */ |
51 | static int inotify_max_user_instances __read_mostly; | 47 | static int inotify_max_user_instances __read_mostly; |
52 | static int inotify_max_queued_events __read_mostly; | 48 | static int inotify_max_queued_events __read_mostly; |
@@ -645,9 +641,7 @@ SYSCALL_DEFINE1(inotify_init1, int, flags) | |||
645 | { | 641 | { |
646 | struct fsnotify_group *group; | 642 | struct fsnotify_group *group; |
647 | struct user_struct *user; | 643 | struct user_struct *user; |
648 | struct file *filp; | 644 | int ret; |
649 | struct path path; | ||
650 | int fd, ret; | ||
651 | 645 | ||
652 | /* Check the IN_* constants for consistency. */ | 646 | /* Check the IN_* constants for consistency. */ |
653 | BUILD_BUG_ON(IN_CLOEXEC != O_CLOEXEC); | 647 | BUILD_BUG_ON(IN_CLOEXEC != O_CLOEXEC); |
@@ -656,10 +650,6 @@ SYSCALL_DEFINE1(inotify_init1, int, flags) | |||
656 | if (flags & ~(IN_CLOEXEC | IN_NONBLOCK)) | 650 | if (flags & ~(IN_CLOEXEC | IN_NONBLOCK)) |
657 | return -EINVAL; | 651 | return -EINVAL; |
658 | 652 | ||
659 | fd = get_unused_fd_flags(flags & O_CLOEXEC); | ||
660 | if (fd < 0) | ||
661 | return fd; | ||
662 | |||
663 | user = get_current_user(); | 653 | user = get_current_user(); |
664 | if (unlikely(atomic_read(&user->inotify_devs) >= | 654 | if (unlikely(atomic_read(&user->inotify_devs) >= |
665 | inotify_max_user_instances)) { | 655 | inotify_max_user_instances)) { |
@@ -676,27 +666,14 @@ SYSCALL_DEFINE1(inotify_init1, int, flags) | |||
676 | 666 | ||
677 | atomic_inc(&user->inotify_devs); | 667 | atomic_inc(&user->inotify_devs); |
678 | 668 | ||
679 | path.mnt = inotify_mnt; | 669 | ret = anon_inode_getfd("inotify", &inotify_fops, group, |
680 | path.dentry = inotify_mnt->mnt_root; | 670 | O_RDONLY | flags); |
681 | path_get(&path); | 671 | if (ret >= 0) |
682 | filp = alloc_file(&path, FMODE_READ, &inotify_fops); | 672 | return ret; |
683 | if (!filp) | ||
684 | goto Enfile; | ||
685 | 673 | ||
686 | filp->f_flags = O_RDONLY | (flags & O_NONBLOCK); | ||
687 | filp->private_data = group; | ||
688 | |||
689 | fd_install(fd, filp); | ||
690 | |||
691 | return fd; | ||
692 | |||
693 | Enfile: | ||
694 | ret = -ENFILE; | ||
695 | path_put(&path); | ||
696 | atomic_dec(&user->inotify_devs); | 674 | atomic_dec(&user->inotify_devs); |
697 | out_free_uid: | 675 | out_free_uid: |
698 | free_uid(user); | 676 | free_uid(user); |
699 | put_unused_fd(fd); | ||
700 | return ret; | 677 | return ret; |
701 | } | 678 | } |
702 | 679 | ||
@@ -783,20 +760,6 @@ out: | |||
783 | return ret; | 760 | return ret; |
784 | } | 761 | } |
785 | 762 | ||
786 | static int | ||
787 | inotify_get_sb(struct file_system_type *fs_type, int flags, | ||
788 | const char *dev_name, void *data, struct vfsmount *mnt) | ||
789 | { | ||
790 | return get_sb_pseudo(fs_type, "inotify", NULL, | ||
791 | INOTIFYFS_SUPER_MAGIC, mnt); | ||
792 | } | ||
793 | |||
794 | static struct file_system_type inotify_fs_type = { | ||
795 | .name = "inotifyfs", | ||
796 | .get_sb = inotify_get_sb, | ||
797 | .kill_sb = kill_anon_super, | ||
798 | }; | ||
799 | |||
800 | /* | 763 | /* |
801 | * inotify_user_setup - Our initialization function. Note that we cannnot return | 764 | * inotify_user_setup - Our initialization function. Note that we cannnot return |
802 | * error because we have compiled-in VFS hooks. So an (unlikely) failure here | 765 | * error because we have compiled-in VFS hooks. So an (unlikely) failure here |
@@ -804,16 +767,6 @@ static struct file_system_type inotify_fs_type = { | |||
804 | */ | 767 | */ |
805 | static int __init inotify_user_setup(void) | 768 | static int __init inotify_user_setup(void) |
806 | { | 769 | { |
807 | int ret; | ||
808 | |||
809 | ret = register_filesystem(&inotify_fs_type); | ||
810 | if (unlikely(ret)) | ||
811 | panic("inotify: register_filesystem returned %d!\n", ret); | ||
812 | |||
813 | inotify_mnt = kern_mount(&inotify_fs_type); | ||
814 | if (IS_ERR(inotify_mnt)) | ||
815 | panic("inotify: kern_mount ret %ld!\n", PTR_ERR(inotify_mnt)); | ||
816 | |||
817 | inotify_inode_mark_cachep = KMEM_CACHE(inotify_inode_mark_entry, SLAB_PANIC); | 770 | inotify_inode_mark_cachep = KMEM_CACHE(inotify_inode_mark_entry, SLAB_PANIC); |
818 | event_priv_cachep = KMEM_CACHE(inotify_event_private_data, SLAB_PANIC); | 771 | event_priv_cachep = KMEM_CACHE(inotify_event_private_data, SLAB_PANIC); |
819 | 772 | ||