Received: by 10.213.65.68 with SMTP id h4csp466258imn; Tue, 13 Mar 2018 09:57:21 -0700 (PDT) X-Google-Smtp-Source: AG47ELvE2gYOYOQ/z+Tam8mippTjFRpYZWUsSyhi7UjtmHQpaQJYsfzniy7DsOwIvURPLlcpzKUs X-Received: by 10.98.71.3 with SMTP id u3mr1236524pfa.219.1520960241761; Tue, 13 Mar 2018 09:57:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520960241; cv=none; d=google.com; s=arc-20160816; b=Z4N+ESofS++4PxDuwOAfOyGdLCOvUeyF2qAdBqIHMXjSGLlbt57mrcILSjq3JSCFmq ZfeuZcq79cDXB3ypZFs4GdLAKjL6dI1G3DkS5AmpJDC67Uqa1M/N7YLnk3le7jJG/nPN mZilLS0/PQaE2iIH86KEHcO93SdmxoCRsKiNQAfThM53AW0Q3DXom170NL3zbZTgJOWE AREzObR6u8I2Zz5b/PqL8xm2Gl2rIwDdC5w/EGLIe//4UX9yyQRoT5ysuicrcAuCPiCF Xtg043UOQxvzQKCBpkzjTz13fy2Q2v0ajyBefFv45izSvQ6iSIvofHLZ02gM+n5d4F7O d9Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=XhNiE2qqWHPiwfvp94IDzinS4JriIaG0mN0SWjhf1lI=; b=DfbRQlYHfiBsQXAnfVXGTaoXbiF12BPKrWWdfxhx29Io1WJCA/+Ic6C8bltacJ5jS+ 2WqOERI+C3M2nHxQcGfegjLWyIbaSbTy1PzQ1lFy1S1Y0C/j9Dt21YacvyKt6deP+cZJ BgYNfa9alcBjeTTe/wrO4db2wfH5Tkm+BH5Jw8gm8F3ccHgTs2TK4u61fiG1ZE1kiPQe oI7/3JuwgP3Ir29HwSUdtNxPT15cClXaOZ9EP9tB1NqKQxsqkwBRpzplnJdt72P2lLJM tHwDyQVFKu19wQBhKGDc+aeDd7mW0mz90EYpp4FHQU3OUDEeizzv3RIYWdbRXqijn2lo KYzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j15-v6si389741pli.649.2018.03.13.09.57.07; Tue, 13 Mar 2018 09:57:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933396AbeCMQzn (ORCPT + 99 others); Tue, 13 Mar 2018 12:55:43 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:44877 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933325AbeCMQzk (ORCPT ); Tue, 13 Mar 2018 12:55:40 -0400 Received: by mail-wr0-f196.google.com with SMTP id v65so779680wrc.11 for ; Tue, 13 Mar 2018 09:55:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XhNiE2qqWHPiwfvp94IDzinS4JriIaG0mN0SWjhf1lI=; b=fViFfEsgKRRSGzFlnhARq0E3qRWmhyOp5FDWCZPQspJiOhN8nL5OOFz1yQqW+LALWk jJ+VDpO1QTq5t6zeVQDE45YMUfDoRyIsZWUQ5t84wbOuTSXttKiqb3Bf8FMfSeDj0cd+ CIh7Vvk349S0JmZECHofr2y3iq4gYMaoT8Fr6E4n/YRyYK2rRiS85lMgfpcA5nAB1LM0 naTR3CUr2Y5VBvlRCDIEoMka1pq9Wkn6ac7CksKDD01v8v8dMqwaGJXFbhfuDXxhp6D5 YE8hqa2YmdyEZm94WSqkz6058qXMuFH56r6q5xv4I/FRUWzWemNzmdqQEuAN17Rs2b7c Du0g== X-Gm-Message-State: AElRT7GclU4/byJl3Ug1bVElxPJJyDFLLAaST7nO6iCA36z7j1MtFnZO zB3WJUMiU71lhawqQLNIoKE= X-Received: by 10.223.173.207 with SMTP id w73mr1208198wrc.234.1520960139614; Tue, 13 Mar 2018 09:55:39 -0700 (PDT) Received: from localhost.localdomain (u-087-c077.eap.uni-tuebingen.de. [134.2.87.77]) by smtp.gmail.com with ESMTPSA id r128sm378881wmf.37.2018.03.13.09.55.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Mar 2018 09:55:38 -0700 (PDT) From: Christian Brauner To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org, ebiederm@xmission.com, torvalds@linux-foundation.org, gregkh@linuxfoundation.org Cc: containers@lists.linux-foundation.org, Christian Brauner Subject: [PATCH 3/4 v5 RESEND] devpts: comment devpts_mntget() Date: Tue, 13 Mar 2018 17:55:26 +0100 Message-Id: <20180313165527.24038-4-christian.brauner@ubuntu.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180313165527.24038-1-christian.brauner@ubuntu.com> References: <20180313165527.24038-1-christian.brauner@ubuntu.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Christian Brauner --- ChangeLog v4->v5: * patch added ChangeLog v3->v4: * patch not present ChangeLog v2->v3: * patch not present ChangeLog v1->v2: * patch not present ChangeLog v0->v1: * patch not present --- fs/devpts/inode.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 542364bf923e..e072e955ce33 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -152,6 +152,24 @@ static int devpts_ptmx_path(struct path *path) return 0; } +/* + * Try to find a suitable devpts filesystem. We support the following + * scenarios: + * - The ptmx device node is located in the same directory as the devpts + * mount where the pts device nodes are located. + * This is e.g. the case when calling open on the /dev/pts/ptmx device + * node when the devpts filesystem is mounted at /dev/pts. + * - The ptmx device node is located outside the devpts filesystem mount + * where the pts device nodes are located. For example, the ptmx device + * is a symlink, separate device node, or bind-mount. + * A supported scenario is bind-mounting /dev/pts/ptmx to /dev/ptmx and + * then calling open on /dev/ptmx. In this case a suitable pts + * subdirectory can be found in the common parent directory /dev of the + * devpts mount and the ptmx bind-mount, after resolving the /dev/ptmx + * bind-mount. + * If no suitable pts subdirectory can be found this function will fail. + * This is e.g. the case when bind-mounting /dev/pts/ptmx to /ptmx. + */ struct vfsmount *devpts_mntget(struct file *filp, struct pts_fs_info *fsi) { struct path path; -- 2.15.1