From: Andreas Gruenbacher <agruen@suse.de>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-kernel@vger.kernel.org, John Johansen <jjohansen@suse.de>,
Jan Blunck <jblunck@suse.de>, Erez Zadok <ezk@cs.sunysb.edu>,
"Josef 'Jeff' Sipek" <jsipek@cs.sunysb.edu>
Subject: [patch 2/4] Use pathput in a few more places
Date: Fri, 10 Aug 2007 16:22:10 +0200 [thread overview]
Message-ID: <20070810143846.930027497@suse.de> (raw)
In-Reply-To: 20070810142208.827949199@suse.de
[-- Attachment #1: more-pathput.diff --]
[-- Type: text/plain, Size: 2131 bytes --]
afs_mntpt_follow_link() actually does mntput before dput, which is wrong.
Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
---
fs/afs/mntpt.c | 3 +--
fs/namei.c | 15 +++++----------
2 files changed, 6 insertions(+), 12 deletions(-)
--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -235,8 +235,7 @@ static void *afs_mntpt_follow_link(struc
err = do_add_mount(newmnt, nd, MNT_SHRINKABLE, &afs_vfsmounts);
switch (err) {
case 0:
- mntput(nd->lookup.path.mnt);
- dput(nd->lookup.path.dentry);
+ pathput(&nd->lookup.path);
nd->lookup.path.mnt = newmnt;
nd->lookup.path.dentry = dget(newmnt->mnt_root);
schedule_delayed_work(&afs_mntpt_expiry_timer,
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -610,8 +610,7 @@ static __always_inline int __do_follow_l
if (dentry->d_inode->i_op->put_link)
dentry->d_inode->i_op->put_link(dentry, nd, cookie);
}
- dput(dentry);
- mntput(path->mnt);
+ pathput(path);
return error;
}
@@ -1016,8 +1015,7 @@ static int fastcall link_path_walk(const
result = __link_path_walk(name, nd);
}
- dput(save.lookup.path.dentry);
- mntput(save.lookup.path.mnt);
+ pathput(&save.lookup.path);
return result;
}
@@ -1038,8 +1036,7 @@ static int __emul_lookup_dentry(const ch
return 0; /* something went wrong... */
if (!nd->lookup.path.dentry->d_inode || S_ISDIR(nd->lookup.path.dentry->d_inode->i_mode)) {
- struct dentry *old_dentry = nd->lookup.path.dentry;
- struct vfsmount *old_mnt = nd->lookup.path.mnt;
+ struct path old_path = nd->lookup.path;
struct qstr last = nd->last;
int last_type = nd->last_type;
struct fs_struct *fs = current->fs;
@@ -1055,14 +1052,12 @@ static int __emul_lookup_dentry(const ch
read_unlock(&fs->lock);
if (path_walk(name, nd) == 0) {
if (nd->lookup.path.dentry->d_inode) {
- dput(old_dentry);
- mntput(old_mnt);
+ pathput(&old_path);
return 1;
}
pathput(&nd->lookup.path);
}
- nd->lookup.path.dentry = old_dentry;
- nd->lookup.path.mnt = old_mnt;
+ nd->lookup.path = old_path;
nd->last = last;
nd->last_type = last_type;
}
next prev parent reply other threads:[~2007-08-10 14:44 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-08 17:16 [RFC 00/10] Split up struct nameidata (take 3) Andreas Gruenbacher
2007-08-08 17:16 ` [RFC 01/10] Split up struct nameidata Andreas Gruenbacher
2007-08-08 19:32 ` Christoph Hellwig
2007-08-09 8:26 ` atomic open (was Re: [RFC 01/10] Split up struct nameidata) Miklos Szeredi
2007-08-10 14:42 ` [RFC 01/10] Split up struct nameidata Andreas Gruenbacher
2007-08-10 14:22 ` [patch 1/4] Introduce pathput Andreas Gruenbacher
2007-08-29 19:07 ` Christoph Hellwig
2007-09-14 16:36 ` Christoph Hellwig
2007-08-10 14:22 ` Andreas Gruenbacher [this message]
2007-08-29 19:08 ` [patch 2/4] Use pathput in a few more places Christoph Hellwig
2007-08-30 15:01 ` [FIX] mntput called before dput in afs Andreas Gruenbacher
2007-08-30 15:15 ` David Howells
2007-08-30 15:56 ` David Howells
2007-08-10 14:22 ` [patch 3/4] Introduce pathget Andreas Gruenbacher
2007-08-29 19:09 ` Christoph Hellwig
2007-08-10 14:22 ` [patch 4/4] Switch to struct path in fs_struct Andreas Gruenbacher
2007-08-29 19:12 ` Christoph Hellwig
2007-08-08 17:16 ` [RFC 02/10] Switch from nd->{mnt,dentry} to nd->lookup.path.{mnt,dentry} Andreas Gruenbacher
2007-08-08 17:16 ` [RFC 03/10] Pass no unnecessary information to iop->permission Andreas Gruenbacher
2007-08-08 17:16 ` [RFC 04/10] Temporary struct vfs_lookup in file_permission Andreas Gruenbacher
2007-08-08 17:58 ` Josef Sipek
2007-08-08 18:56 ` Andreas Gruenbacher
2007-08-08 19:25 ` Christoph Hellwig
2007-08-08 21:41 ` Andreas Gruenbacher
2007-08-08 23:24 ` Christoph Hellwig
2007-08-09 17:23 ` Andreas Gruenbacher
2007-08-08 17:16 ` [RFC 05/10] Use vfs_permission instead of file_permission in sys_fchdir Andreas Gruenbacher
2007-08-08 19:26 ` Christoph Hellwig
2007-08-08 17:16 ` [RFC 06/10] Use vfs_permission instead of file_permission in do_path_lookup Andreas Gruenbacher
2007-08-08 19:27 ` Christoph Hellwig
2007-08-08 17:16 ` [RFC 07/10] Pass no unnecessary information to iop->create Andreas Gruenbacher
2007-08-08 17:16 ` [RFC 08/10] Pass no NULL vfs_lookup to vfs_create Andreas Gruenbacher
2007-08-08 19:36 ` Christoph Hellwig
2007-08-08 17:16 ` [RFC 09/10] Pass no unnecessary information to dop->d_revalidate Andreas Gruenbacher
2007-08-08 17:16 ` [RFC 10/10] Pass no unnecessary information to iop->lookup Andreas Gruenbacher
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=20070810143846.930027497@suse.de \
--to=agruen@suse.de \
--cc=ezk@cs.sunysb.edu \
--cc=hch@infradead.org \
--cc=jblunck@suse.de \
--cc=jjohansen@suse.de \
--cc=jsipek@cs.sunysb.edu \
--cc=linux-kernel@vger.kernel.org \
/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