diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-08-05 10:35:21 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-16 12:16:40 -0500 |
commit | 825f9692fbe417b9fb529477056ba72022847038 (patch) | |
tree | be3b8a22940f00e9d620d188814d5adc63e8108e /fs | |
parent | 4b42af81f0d7f95dff320f47d99c201925f406f5 (diff) |
switched inotify_init1() to alloc_file()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/notify/inotify/inotify_user.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index 5ef5f365a5c8..9e4f90042eaf 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c | |||
@@ -659,12 +659,6 @@ SYSCALL_DEFINE1(inotify_init1, int, flags) | |||
659 | if (fd < 0) | 659 | if (fd < 0) |
660 | return fd; | 660 | return fd; |
661 | 661 | ||
662 | filp = get_empty_filp(); | ||
663 | if (!filp) { | ||
664 | ret = -ENFILE; | ||
665 | goto out_put_fd; | ||
666 | } | ||
667 | |||
668 | user = get_current_user(); | 662 | user = get_current_user(); |
669 | if (unlikely(atomic_read(&user->inotify_devs) >= | 663 | if (unlikely(atomic_read(&user->inotify_devs) >= |
670 | inotify_max_user_instances)) { | 664 | inotify_max_user_instances)) { |
@@ -679,24 +673,25 @@ SYSCALL_DEFINE1(inotify_init1, int, flags) | |||
679 | goto out_free_uid; | 673 | goto out_free_uid; |
680 | } | 674 | } |
681 | 675 | ||
682 | filp->f_op = &inotify_fops; | 676 | atomic_inc(&user->inotify_devs); |
683 | filp->f_path.mnt = mntget(inotify_mnt); | 677 | |
684 | filp->f_path.dentry = dget(inotify_mnt->mnt_root); | 678 | filp = alloc_file(inotify_mnt, dget(inotify_mnt->mnt_root), |
685 | filp->f_mapping = filp->f_path.dentry->d_inode->i_mapping; | 679 | FMODE_READ, &inotify_fops); |
686 | filp->f_mode = FMODE_READ; | 680 | if (!filp) |
681 | goto Enfile; | ||
682 | |||
687 | filp->f_flags = O_RDONLY | (flags & O_NONBLOCK); | 683 | filp->f_flags = O_RDONLY | (flags & O_NONBLOCK); |
688 | filp->private_data = group; | 684 | filp->private_data = group; |
689 | 685 | ||
690 | atomic_inc(&user->inotify_devs); | ||
691 | |||
692 | fd_install(fd, filp); | 686 | fd_install(fd, filp); |
693 | 687 | ||
694 | return fd; | 688 | return fd; |
695 | 689 | ||
690 | Enfile: | ||
691 | ret = -ENFILE; | ||
692 | atomic_dec(&user->inotify_devs); | ||
696 | out_free_uid: | 693 | out_free_uid: |
697 | free_uid(user); | 694 | free_uid(user); |
698 | put_filp(filp); | ||
699 | out_put_fd: | ||
700 | put_unused_fd(fd); | 695 | put_unused_fd(fd); |
701 | return ret; | 696 | return ret; |
702 | } | 697 | } |