Received: by 10.213.65.68 with SMTP id h4csp1785250imn; Thu, 5 Apr 2018 03:53:17 -0700 (PDT) X-Google-Smtp-Source: AIpwx486TzfK1zydQD76Wovq2u56/uBlkabF6RhEExnfD02xG3OpdWbmL+2YW6kK48DpRTS/rdQb X-Received: by 2002:a17:902:5681:: with SMTP id j1-v6mr22563034pli.383.1522925597284; Thu, 05 Apr 2018 03:53:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522925597; cv=none; d=google.com; s=arc-20160816; b=zXcsBp76b/+UfKF+l6gC57LiOvK2GeAb+46NM3Af2FZGUSEChckxhQcVNtguy2XJOy 4NAuugQmTPqzkuV61+Kyc6UjJvBHa/bOhsN03Xk51b7bJMNIFgUSqZDrG0wiKEhcBLkc kfS8mlowK5TcPZmc/Bz2XjQkreYPZAvfexNVPucG1XNb3eiAOaHB2gZi9BCEy5mGRQ+2 cRQApbtc0okeze+RptMrhPgdWchNDdgUT80jU++RMzS/S7fwf9jXRRn8sPI6RorcWjHs 6RlIKzpBNmPQdtqD/vWJ+uGmtSIaNQbIhM071xz8/KhVS3pxh8xumY3pJ4J8a1YC9HcK k5sw== 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=HsOP+YO0CtejsFzoZvZSeW9uf5W9ks6hEMxtKeHaM0I=; b=Q5e0aoTYEb2Is2CJ7LNPdGq3BSrwHd22i4b+0gZDTcpXsL1xIb3/971tckSkWs2w9/ u0adsfFISHf4bIxxQCw5d8mxfVezlnYtnUXcZraTr/4xCnUXwoegc4D2+/9+FL1HVael mVaRqIWGvCDnB7A3CuOx+wdMEFHIey2HuU7GhfEMLw2XSCCvihxPvUxqWPghgHGt9I4k lJkzVgqFxttWcCOYYl1Jcn/+mAz/N0okE1GFllSdVCXFWdXEcuG7/fvkt2WkwTU9Rt6k aibmlMKoAixe2OyUd5YpFbqa1c1OO5fGgLtTnpUgwbuaP9hDjc583niyL/0+/Xm8cKpd ARBA== 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 i84si5946802pfk.233.2018.04.05.03.53.03; Thu, 05 Apr 2018 03:53:17 -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 S1751538AbeDEKvX (ORCPT + 99 others); Thu, 5 Apr 2018 06:51:23 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:40014 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751280AbeDEKvV (ORCPT ); Thu, 5 Apr 2018 06:51:21 -0400 Received: by mail-wm0-f68.google.com with SMTP id x4so5694835wmh.5 for ; Thu, 05 Apr 2018 03:51:20 -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=HsOP+YO0CtejsFzoZvZSeW9uf5W9ks6hEMxtKeHaM0I=; b=Eu1YXqiYjJqvI/rIPeM6Nh6ubzuVlRFf2ftRcYjBMIMEwWopiB+eQV3DgssfNLY7+O Ym0CK/myUn55uSpqdUc8Dwy+uceq3t4a9QSFzLD5uHOmQ/Xb6swOc08qmXl8FiXoFO7w bixJXjHdFiURIn9p9rT72zoJsd03W0qvwPtn4HBjC7ZT78YoTydYCXnh3+1dWT1CHzfW /VvgPIFlEjCxqcviyCoqANwyaJrWuf8eKYgy2xP40a1YyOITRjeLwcJl5bpTVc24/fcD 7Ze2XfnkJhdBNUzYUf+YNPbkCB8qfLjBWrr/iHneDrPW0XuuB6WhgMO+n7U5/jGnCOYd nWxg== X-Gm-Message-State: AElRT7FPCEqFO2vKHZQUOfqT+p3qJBj2WnKhUx+zMoX3RyeeFu/i9iLj zV9IIO9TeAckQGSS/b9b7cQ= X-Received: by 10.28.14.70 with SMTP id 67mr11720141wmo.17.1522925480282; Thu, 05 Apr 2018 03:51:20 -0700 (PDT) Received: from localhost.localdomain (u-086-c187.eap.uni-tuebingen.de. [134.2.86.187]) by smtp.gmail.com with ESMTPSA id n47sm8418599wrf.41.2018.04.05.03.51.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Apr 2018 03:51:19 -0700 (PDT) From: Christian Brauner To: torvalds@linux-foundation.org, viro@zeniv.linux.org.uk, ebiederm@xmission.com, linux-kernel@vger.kernel.org Cc: Christian Brauner Subject: [PATCH 1/3 RESEND] namei: add follow_up_bind() Date: Thu, 5 Apr 2018 12:51:01 +0200 Message-Id: <20180405105103.21572-2-christian.brauner@ubuntu.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180405105103.21572-1-christian.brauner@ubuntu.com> References: <20180405105103.21572-1-christian.brauner@ubuntu.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds a new helper for resolving bind-mounts. Signed-off-by: Christian Brauner --- fs/namei.c | 10 ++++++++++ include/linux/namei.h | 1 + 2 files changed, 11 insertions(+) diff --git a/fs/namei.c b/fs/namei.c index a09419379f5d..4fa56ec78f63 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1085,6 +1085,16 @@ int follow_up(struct path *path) } EXPORT_SYMBOL(follow_up); +/* + * follow_up_bind - Resolve bind-mounts to mountpoint of path's vfsmount + */ +inline void follow_up_bind(struct path *path) +{ + while (path->mnt->mnt_root == path->dentry && follow_up(path)) + ; +} +EXPORT_SYMBOL(follow_up_bind); + /* * Perform an automount * - return -EISDIR to tell follow_managed() to stop and return the path we diff --git a/include/linux/namei.h b/include/linux/namei.h index a982bb7cd480..ea93127be26c 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h @@ -87,6 +87,7 @@ extern struct dentry *lookup_one_len_unlocked(const char *, struct dentry *, int extern int follow_down_one(struct path *); extern int follow_down(struct path *); extern int follow_up(struct path *); +extern void follow_up_bind(struct path *path); extern struct dentry *lock_rename(struct dentry *, struct dentry *); extern void unlock_rename(struct dentry *, struct dentry *); -- 2.15.1