Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752313AbdHPSsu (ORCPT ); Wed, 16 Aug 2017 14:48:50 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:33927 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751611AbdHPSst (ORCPT ); Wed, 16 Aug 2017 14:48:49 -0400 MIME-Version: 1.0 In-Reply-To: References: <20170816171211.4021-1-christian.brauner@ubuntu.com> From: Linus Torvalds Date: Wed, 16 Aug 2017 11:48:48 -0700 X-Google-Sender-Auth: vV1N_BzFAUdJn6xp24yWM2BDwE0 Message-ID: Subject: Re: [PATCH 0/1] devpts: use dynamic_dname() to generate proc name To: Christian Brauner Cc: Linux Kernel Mailing List , "Serge E. Hallyn" , Al Viro Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1214 Lines: 40 On Wed, Aug 16, 2017 at 11:26 AM, Linus Torvalds wrote: > > Hardcoding "/dev/pts/%d" is something that user space can already do. > The kernel can and should do better. Put another way: there's no point in applying the patch as-is, since existing glibc ptsname() does the same thing better and faster entirely in user space. Also, we already do special things to get a path for this, but it clearly isn't working. See the /* We need to cache a fake path for TIOCGPTPEER. */ comment in ptmx_open(). Why doesn't the file d_path get filled in correctly there, I wonder. Because The regular readlink("/proc/self/fd/0", ...) that 'tty' does works correctly. I think we've done something incorrect in pty_open_peer(), which means that the fd path hasn't been fully filled in. Fixing that *should* fix the readlink() automatically, since it clearly works for the 'tty' binary. I'm wondering why it's not working as-is. "vfs_open()" does that file->f_path = *path; thing. Why aren't we getting the right path? The ptmx_open() code looks ok to me. Al, do you see what the issue is, and why we don't get a proper path on that readlink? Linus