提交 868eb7a8 编写于 作者: J Jan Blunck 提交者: Linus Torvalds

autofs: path_{get,put}() cleanups

Here are some more places where path_{get,put}() can be used instead of
dput()/mntput() pair.  Besides that it fixes a bug in autofs4_mount_busy()
where mntput() was called before dput().
Signed-off-by: NJan Blunck <jblunck@suse.de>
Cc: Ian Kent <raven@themaw.net>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 9d2de6ad
...@@ -73,8 +73,8 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry) ...@@ -73,8 +73,8 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry)
status = 0; status = 0;
done: done:
DPRINTK("returning = %d", status); DPRINTK("returning = %d", status);
mntput(mnt);
dput(dentry); dput(dentry);
mntput(mnt);
return status; return status;
} }
......
...@@ -146,17 +146,17 @@ static int autofs4_dir_open(struct inode *inode, struct file *file) ...@@ -146,17 +146,17 @@ static int autofs4_dir_open(struct inode *inode, struct file *file)
if (d_mountpoint(dentry)) { if (d_mountpoint(dentry)) {
struct file *fp = NULL; struct file *fp = NULL;
struct vfsmount *fp_mnt = mntget(mnt); struct path fp_path = { .dentry = dentry, .mnt = mnt };
struct dentry *fp_dentry = dget(dentry);
if (!autofs4_follow_mount(&fp_mnt, &fp_dentry)) { path_get(&fp_path);
dput(fp_dentry);
mntput(fp_mnt); if (!autofs4_follow_mount(&fp_path.mnt, &fp_path.dentry)) {
path_put(&fp_path);
dcache_dir_close(inode, file); dcache_dir_close(inode, file);
goto out; goto out;
} }
fp = dentry_open(fp_dentry, fp_mnt, file->f_flags); fp = dentry_open(fp_path.dentry, fp_path.mnt, file->f_flags);
status = PTR_ERR(fp); status = PTR_ERR(fp);
if (IS_ERR(fp)) { if (IS_ERR(fp)) {
dcache_dir_close(inode, file); dcache_dir_close(inode, file);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册