if (!dir_emit_dots(file, ctx))
                return 0;
-       if (ctx->pos == 2) {
-               spin_lock(&configfs_dirent_lock);
+       spin_lock(&configfs_dirent_lock);
+       if (ctx->pos == 2)
                list_move(q, &parent_sd->s_children);
-               spin_unlock(&configfs_dirent_lock);
-       }
        for (p = q->next; p != &parent_sd->s_children; p = p->next) {
                struct configfs_dirent *next;
                const char *name;
                if (!next->s_element)
                        continue;
 
-               name = configfs_get_name(next);
-               len = strlen(name);
-
                /*
                 * We'll have a dentry and an inode for
                 * PINNED items and for open attribute
                 * they close it.  Beyond that, we don't
                 * care.
                 */
-               spin_lock(&configfs_dirent_lock);
                dentry = next->s_dentry;
                if (dentry)
                        inode = d_inode(dentry);
                if (!inode)
                        ino = iunique(sb, 2);
 
+               name = configfs_get_name(next);
+               len = strlen(name);
+
                if (!dir_emit(ctx, name, len, ino, dt_type(next)))
                        return 0;
 
                spin_lock(&configfs_dirent_lock);
                list_move(q, p);
-               spin_unlock(&configfs_dirent_lock);
                p = q;
                ctx->pos++;
        }
+       spin_unlock(&configfs_dirent_lock);
        return 0;
 }
 
 {
        struct dentry * dentry = file->f_path.dentry;
 
-       inode_lock(d_inode(dentry));
        switch (whence) {
                case 1:
                        offset += file->f_pos;
                        if (offset >= 0)
                                break;
                default:
-                       inode_unlock(d_inode(dentry));
                        return -EINVAL;
        }
        if (offset != file->f_pos) {
                        spin_unlock(&configfs_dirent_lock);
                }
        }
-       inode_unlock(d_inode(dentry));
        return offset;
 }
 
        .release        = configfs_dir_close,
        .llseek         = configfs_dir_lseek,
        .read           = generic_read_dir,
-       .iterate        = configfs_readdir,
+       .iterate_shared = configfs_readdir,
 };
 
 /**