From: Vineeth Remanan Pillai <vineethp@amazon.com>
To: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Vineeth Remanan Pillai <vineethp@amazon.com>,
kamatam@amazon.com, aliguori@amazon.com
Subject: [PATCH] namei: revert old behaviour for filename_lookup with LOOKUP_PARENT flag
Date: Thu, 13 Oct 2016 19:58:51 +0000 [thread overview]
Message-ID: <1476388731-24053-1-git-send-email-vineethp@amazon.com> (raw)
filename_lookup used to return success for non-existing file when called
with LOOKUP_PARENT flag. This behaviour was changed with
commit 8bcb77fabd7c ("namei: split off filename_lookupat()
with LOOKUP_PARENT")
The above patch split parent lookup functionality to a different function
filename_parentat and changed all calls to filename_lookup(LOOKUP_PARENT)
to the new function filename_parentat. But functions like kern_path which
passed the flags directly to filename_lookup regressed due to this.
This patch aims to fix the regressed behaviour by calling
filename_parentat from filename_lookup if the flags contain LOOKUP_PARENT.
Signed-off-by: Vineeth Remanan Pillai <vineethp@amazon.com>
---
fs/namei.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/fs/namei.c b/fs/namei.c
index adb0414..e16ab09 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2292,6 +2292,21 @@ static int filename_lookup(int dfd, struct filename *name, unsigned flags,
{
int retval;
struct nameidata nd;
+
+ if (flags & LOOKUP_PARENT) {
+ struct qstr last;
+ struct filename *filename;
+ int type;
+
+ filename = filename_parentat(dfd, name, flags ^ LOOKUP_PARENT,
+ path, &last, &type);
+ if (IS_ERR(filename))
+ return PTR_ERR(filename);
+
+ putname(filename);
+ return 0;
+ }
+
if (IS_ERR(name))
return PTR_ERR(name);
if (unlikely(root)) {
--
2.1.2.AMZN
next reply other threads:[~2016-10-13 19:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-13 19:58 Vineeth Remanan Pillai [this message]
2016-10-13 20:06 ` [PATCH] namei: revert old behaviour for filename_lookup with LOOKUP_PARENT flag Al Viro
2016-10-13 20:09 ` Christoph Hellwig
2016-10-13 20:26 ` Al Viro
2016-10-13 20:41 ` Vineeth Remanan Pillai
2016-10-13 20:44 ` Christoph Hellwig
2016-10-13 21:24 ` Al Viro
2016-10-13 22:14 ` Vineeth Remanan Pillai
2016-10-13 23:31 ` Al Viro
2016-10-14 0:02 ` Remanan Pillai, Vineeth
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=1476388731-24053-1-git-send-email-vineethp@amazon.com \
--to=vineethp@amazon.com \
--cc=aliguori@amazon.com \
--cc=kamatam@amazon.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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: link
Be 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).