[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200301215240.873899-27-viro@ZenIV.linux.org.uk>
Date: Sun, 1 Mar 2020 21:52:12 +0000
From: Al Viro <viro@...IV.linux.org.uk>
To: linux-fsdevel@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [RFC][PATCH v3 27/55] pick_link(): check for WALK_TRAILING, not LOOKUP_PARENT
From: Al Viro <viro@...iv.linux.org.uk>
Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
fs/namei.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index f994ed10ef39..56bbbb9c0c0d 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1723,8 +1723,10 @@ static inline int handle_dots(struct nameidata *nd, int type)
return 0;
}
+enum {WALK_TRAILING = 1, WALK_MORE = 2, WALK_NOFOLLOW = 4};
+
static const char *pick_link(struct nameidata *nd, struct path *link,
- struct inode *inode, unsigned seq)
+ struct inode *inode, unsigned seq, int flags)
{
struct saved *last;
const char *res;
@@ -1762,7 +1764,7 @@ static const char *pick_link(struct nameidata *nd, struct path *link,
clear_delayed_call(&last->done);
last->seq = seq;
- if (!(nd->flags & LOOKUP_PARENT)) {
+ if (flags & WALK_TRAILING) {
error = may_follow_link(nd, inode);
if (unlikely(error))
return ERR_PTR(error);
@@ -1819,8 +1821,6 @@ static const char *pick_link(struct nameidata *nd, struct path *link,
return NULL;
}
-enum {WALK_TRAILING = 1, WALK_MORE = 2, WALK_NOFOLLOW = 4};
-
/*
* Do we need to follow links? We _really_ want to be able
* to do this check without having to look at inode->i_op,
@@ -1851,7 +1851,7 @@ static const char *step_into(struct nameidata *nd, int flags,
if (read_seqcount_retry(&path.dentry->d_seq, seq))
return ERR_PTR(-ECHILD);
}
- return pick_link(nd, &path, inode, seq);
+ return pick_link(nd, &path, inode, seq, flags);
}
static const char *walk_component(struct nameidata *nd, int flags)
--
2.11.0
Powered by blists - more mailing lists