proc_sys_fill_cache(): switch to d_alloc_parallel()
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 20 Apr 2016 20:36:09 +0000 (16:36 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 2 May 2016 23:49:30 +0000 (19:49 -0400)
make it usable with directory locked shared

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/proc/proc_sysctl.c

index fe5b6e6c46719a79de1d808de782ccfd20bf67a8..d69e2385862c2454cae96c525df6db67a3bfa2f2 100644 (file)
@@ -627,18 +627,19 @@ static bool proc_sys_fill_cache(struct file *file,
 
        child = d_lookup(dir, &qname);
        if (!child) {
-               child = d_alloc(dir, &qname);
-               if (child) {
+               DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq);
+               child = d_alloc_parallel(dir, &qname, &wq);
+               if (IS_ERR(child))
+                       return false;
+               if (d_in_lookup(child)) {
                        inode = proc_sys_make_inode(dir->d_sb, head, table);
                        if (!inode) {
+                               d_lookup_done(child);
                                dput(child);
                                return false;
-                       } else {
-                               d_set_d_op(child, &proc_sys_dentry_operations);
-                               d_add(child, inode);
                        }
-               } else {
-                       return false;
+                       d_set_d_op(child, &proc_sys_dentry_operations);
+                       d_add(child, inode);
                }
        }
        inode = d_inode(child);