Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177383
b: refs/heads/master
c: 825f969
h: refs/heads/master
i:
  177381: c6c9a89
  177379: cc8486b
  177375: 914754e
v: v3
  • Loading branch information
Al Viro committed Dec 16, 2009
1 parent 82d442a commit 3752aaf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4b42af81f0d7f95dff320f47d99c201925f406f5
refs/heads/master: 825f9692fbe417b9fb529477056ba72022847038
25 changes: 10 additions & 15 deletions trunk/fs/notify/inotify/inotify_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,12 +659,6 @@ SYSCALL_DEFINE1(inotify_init1, int, flags)
if (fd < 0)
return fd;

filp = get_empty_filp();
if (!filp) {
ret = -ENFILE;
goto out_put_fd;
}

user = get_current_user();
if (unlikely(atomic_read(&user->inotify_devs) >=
inotify_max_user_instances)) {
Expand All @@ -679,24 +673,25 @@ SYSCALL_DEFINE1(inotify_init1, int, flags)
goto out_free_uid;
}

filp->f_op = &inotify_fops;
filp->f_path.mnt = mntget(inotify_mnt);
filp->f_path.dentry = dget(inotify_mnt->mnt_root);
filp->f_mapping = filp->f_path.dentry->d_inode->i_mapping;
filp->f_mode = FMODE_READ;
atomic_inc(&user->inotify_devs);

filp = alloc_file(inotify_mnt, dget(inotify_mnt->mnt_root),
FMODE_READ, &inotify_fops);
if (!filp)
goto Enfile;

filp->f_flags = O_RDONLY | (flags & O_NONBLOCK);
filp->private_data = group;

atomic_inc(&user->inotify_devs);

fd_install(fd, filp);

return fd;

Enfile:
ret = -ENFILE;
atomic_dec(&user->inotify_devs);
out_free_uid:
free_uid(user);
put_filp(filp);
out_put_fd:
put_unused_fd(fd);
return ret;
}
Expand Down

0 comments on commit 3752aaf

Please sign in to comment.