Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 19 Jul 2019 18:35:08 +0000 (11:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 19 Jul 2019 18:35:08 +0000 (11:35 -0700)
Pull misc vfs updates from Al Viro:
 "Assorted stuff"

* 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  perf_event_get(): don't bother with fget_raw()
  vfs: update d_make_root() description

Documentation/filesystems/porting
kernel/events/core.c

index 2813a19389fe2b226fa7c9b475f0d616e7ae2774..209672010fb465c282ca597e694ad0bb635bca81 100644 (file)
@@ -428,8 +428,19 @@ release it yourself.
 --
 [mandatory]
        d_alloc_root() is gone, along with a lot of bugs caused by code
-misusing it.  Replacement: d_make_root(inode).  The difference is,
-d_make_root() drops the reference to inode if dentry allocation fails.  
+misusing it.  Replacement: d_make_root(inode).  On success d_make_root(inode)
+allocates and returns a new dentry instantiated with the passed in inode.
+On failure NULL is returned and the passed in inode is dropped so the reference
+to inode is consumed in all cases and failure handling need not do any cleanup
+for the inode.  If d_make_root(inode) is passed a NULL inode it returns NULL
+and also requires no further error handling. Typical usage is:
+
+       inode = foofs_new_inode(....);
+       s->s_root = d_make_inode(inode);
+       if (!s->s_root)
+               /* Nothing needed for the inode cleanup */
+               return -ENOMEM;
+       ...
 
 --
 [mandatory]
index eea9d52b010c7a611dd08af16b934ff5508e5d45..026a14541a38223669a021585f0539e9d45f7628 100644 (file)
@@ -11618,9 +11618,7 @@ void perf_event_delayed_put(struct task_struct *task)
 
 struct file *perf_event_get(unsigned int fd)
 {
-       struct file *file;
-
-       file = fget_raw(fd);
+       struct file *file = fget(fd);
        if (!file)
                return ERR_PTR(-EBADF);