LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Christian Brauner <christian.brauner@ubuntu.com> To: ebiederm@xmission.com, torvalds@linux-foundation.o, viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: Christian Brauner <christian.brauner@ubuntu.com> Subject: [PATCH 1/3] namei: add follow_up_bind() Date: Thu, 5 Apr 2018 12:45:47 +0200 [thread overview] Message-ID: <20180405104549.12365-2-christian.brauner@ubuntu.com> (raw) In-Reply-To: <20180405104549.12365-1-christian.brauner@ubuntu.com> This adds a new helper for resolving bind-mounts. Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> --- 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
next prev parent reply other threads:[~2018-04-05 10:46 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-04-05 10:45 [PATCH 0/3] namei: add follow_up_bind() Christian Brauner 2018-04-05 10:45 ` Christian Brauner [this message] 2018-04-05 10:45 ` [PATCH 2/3] devpts: use follow_up_bind() helper Christian Brauner 2018-04-05 10:45 ` [PATCH 3/3] nfsd: " Christian Brauner
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180405104549.12365-2-christian.brauner@ubuntu.com \ --to=christian.brauner@ubuntu.com \ --cc=ebiederm@xmission.com \ --cc=linux-kernel@vger.kernel.org \ --cc=torvalds@linux-foundation.o \ --cc=viro@zeniv.linux.org.uk \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).