aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/namei.h
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2019-07-16 21:20:17 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2019-09-03 09:30:45 -0400
commit84a2bd39405ffd5fa6d6d77e408c5b9210da98de (patch)
treebe5ba81e98be9f580b80729c0e24c1645a83f000 /include/linux/namei.h
parentfs/namei.c: new helper - legitimize_root() (diff)
downloadlinux-dev-84a2bd39405ffd5fa6d6d77e408c5b9210da98de.tar.xz
linux-dev-84a2bd39405ffd5fa6d6d77e408c5b9210da98de.zip
fs/namei.c: keep track of nd->root refcount status
The rules for nd->root are messy: * if we have LOOKUP_ROOT, it doesn't contribute to refcounts * if we have LOOKUP_RCU, it doesn't contribute to refcounts * if nd->root.mnt is NULL, it doesn't contribute to refcounts * otherwise it does contribute terminate_walk() needs to drop the references if they are contributing. So everything else should be careful not to confuse it, leading to rather convoluted code. It's easier to keep track of whether we'd grabbed the reference(s) explicitly. Use a new flag for that. Don't bother with zeroing nd->root.mnt on unlazy failures and in terminate_walk - it's not needed anymore (terminate_walk() won't care and the next path_init() will zero nd->root in !LOOKUP_ROOT case anyway). Resulting rules for nd->root refcounts are much simpler: they are contributing iff LOOKUP_ROOT_GRABBED is set in nd->flags. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/namei.h')
-rw-r--r--include/linux/namei.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/namei.h b/include/linux/namei.h
index b7993980516e..397a08ade6a2 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -37,6 +37,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
#define LOOKUP_NO_REVAL 0x0080
#define LOOKUP_JUMPED 0x1000
#define LOOKUP_ROOT 0x2000
+#define LOOKUP_ROOT_GRABBED 0x0008
extern int path_pts(struct path *path);