]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - fs/notify/fanotify/fanotify_user.c
switch simple cases of fget_light to fdget
[mirror_ubuntu-zesty-kernel.git] / fs / notify / fanotify / fanotify_user.c
index ea48693940f1b7eabe3ffd992b2df253f20e9506..721d692fa8d4a20dd5bf593d3f732d8b3f913261 100644 (file)
@@ -451,24 +451,22 @@ static int fanotify_find_path(int dfd, const char __user *filename,
                 dfd, filename, flags);
 
        if (filename == NULL) {
-               struct file *file;
-               int fput_needed;
+               struct fd f = fdget(dfd);
 
                ret = -EBADF;
-               file = fget_light(dfd, &fput_needed);
-               if (!file)
+               if (!f.file)
                        goto out;
 
                ret = -ENOTDIR;
                if ((flags & FAN_MARK_ONLYDIR) &&
-                   !(S_ISDIR(file->f_path.dentry->d_inode->i_mode))) {
-                       fput_light(file, fput_needed);
+                   !(S_ISDIR(f.file->f_path.dentry->d_inode->i_mode))) {
+                       fdput(f);
                        goto out;
                }
 
-               *path = file->f_path;
+               *path = f.file->f_path;
                path_get(path);
-               fput_light(file, fput_needed);
+               fdput(f);
        } else {
                unsigned int lookup_flags = 0;
 
@@ -748,9 +746,9 @@ SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags,
        struct inode *inode = NULL;
        struct vfsmount *mnt = NULL;
        struct fsnotify_group *group;
-       struct file *filp;
+       struct fd f;
        struct path path;
-       int ret, fput_needed;
+       int ret;
 
        pr_debug("%s: fanotify_fd=%d flags=%x dfd=%d pathname=%p mask=%llx\n",
                 __func__, fanotify_fd, flags, dfd, pathname, mask);
@@ -784,15 +782,15 @@ SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags,
 #endif
                return -EINVAL;
 
-       filp = fget_light(fanotify_fd, &fput_needed);
-       if (unlikely(!filp))
+       f = fdget(fanotify_fd);
+       if (unlikely(!f.file))
                return -EBADF;
 
        /* verify that this is indeed an fanotify instance */
        ret = -EINVAL;
-       if (unlikely(filp->f_op != &fanotify_fops))
+       if (unlikely(f.file->f_op != &fanotify_fops))
                goto fput_and_out;
-       group = filp->private_data;
+       group = f.file->private_data;
 
        /*
         * group->priority == FS_PRIO_0 == FAN_CLASS_NOTIF.  These are not
@@ -839,7 +837,7 @@ SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags,
 
        path_put(&path);
 fput_and_out:
-       fput_light(filp, fput_needed);
+       fdput(f);
        return ret;
 }