From: Jan Blunck Date: Thu, 1 May 2008 11:35:10 +0000 (-0700) Subject: autofs: path_{get,put}() cleanups X-Git-Tag: v3.12-rc1~20927 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=868eb7a8539d3e8c494209be2b1f4084a274dfef;p=kernel%2Fkernel-generic.git 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: Jan Blunck Cc: Ian Kent Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index cfa12db..894fee5 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c @@ -73,8 +73,8 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry) status = 0; done: DPRINTK("returning = %d", status); - mntput(mnt); dput(dentry); + mntput(mnt); return status; } diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index 6e25003..edf5b6b 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c @@ -146,17 +146,17 @@ static int autofs4_dir_open(struct inode *inode, struct file *file) if (d_mountpoint(dentry)) { struct file *fp = NULL; - struct vfsmount *fp_mnt = mntget(mnt); - struct dentry *fp_dentry = dget(dentry); + struct path fp_path = { .dentry = dentry, .mnt = mnt }; - if (!autofs4_follow_mount(&fp_mnt, &fp_dentry)) { - dput(fp_dentry); - mntput(fp_mnt); + path_get(&fp_path); + + if (!autofs4_follow_mount(&fp_path.mnt, &fp_path.dentry)) { + path_put(&fp_path); dcache_dir_close(inode, file); 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); if (IS_ERR(fp)) { dcache_dir_close(inode, file);