[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1332759264-23533-5-git-send-email-miklos@szeredi.hu>
Date: Mon, 26 Mar 2012 12:54:22 +0200
From: Miklos Szeredi <miklos@...redi.hu>
To: viro@...IV.linux.org.uk
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
hch@...radead.org, mszeredi@...e.cz
Subject: [PATCH 4/6] vfs: set LOOKUP_JUMPED in follow_managed
From: Miklos Szeredi <mszeredi@...e.cz>
This is cleaner than if callers need to do it.
Signed-off-by: Miklos Szeredi <mszeredi@...e.cz>
---
fs/namei.c | 27 +++++++++++++--------------
1 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index 3e13412..482992e 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -794,8 +794,10 @@ static int follow_automount(struct path *path, unsigned flags,
* This may only be called in refwalk mode.
*
* Serialization is taken care of in namespace.c
+ *
+ * If a mount was followed, set LOOKUP_JUMPED in nd->flags
*/
-static int follow_managed(struct path *path, unsigned flags)
+static int follow_managed(struct path *path, struct nameidata *nd)
{
struct vfsmount *mnt = path->mnt; /* held by caller, must be left alone */
unsigned managed;
@@ -839,7 +841,7 @@ static int follow_managed(struct path *path, unsigned flags)
/* Handle an automount point */
if (managed & DCACHE_NEED_AUTOMOUNT) {
- ret = follow_automount(path, flags, &need_mntput);
+ ret = follow_automount(path, nd->flags, &need_mntput);
if (ret < 0)
break;
continue;
@@ -851,9 +853,11 @@ static int follow_managed(struct path *path, unsigned flags)
if (need_mntput && path->mnt == mnt)
mntput(path->mnt);
- if (ret == -EISDIR)
- ret = 0;
- return ret < 0 ? ret : need_mntput;
+ if (ret < 0 && ret != -EISDIR)
+ return ret;
+ if (need_mntput)
+ nd->flags |= LOOKUP_JUMPED;
+ return 0;
}
int follow_down_one(struct path *path)
@@ -1212,13 +1216,11 @@ retry:
path->mnt = mnt;
path->dentry = dentry;
- err = follow_managed(path, nd->flags);
- if (unlikely(err < 0)) {
+ err = follow_managed(path, nd);
+ if (unlikely(err)) {
path_put_conditional(path, nd);
return err;
}
- if (err)
- nd->flags |= LOOKUP_JUMPED;
*inode = path->dentry->d_inode;
return 0;
}
@@ -2239,12 +2241,9 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
if (open_flag & O_EXCL)
goto exit_dput;
- error = follow_managed(path, nd->flags);
- if (error < 0)
- goto exit_dput;
-
+ error = follow_managed(path, nd);
if (error)
- nd->flags |= LOOKUP_JUMPED;
+ goto exit_dput;
error = -ENOENT;
if (!path->dentry->d_inode)
--
1.7.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists