diff mbox

NFS: Fix memroy leak for double mounts

Message ID 534CFA73.4040801@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kinglong Mee April 15, 2014, 9:22 a.m. UTC
When double mounting same nfs filesystem, the devname saved in d_fsdata
will be lost.The second mount should not change the devname that
be saved in d_fsdata.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 fs/nfs/getroot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

 	}

Comments

Trond Myklebust April 15, 2014, 2:27 p.m. UTC | #1
On Tue, 2014-04-15 at 17:22 +0800, Kinglong Mee wrote:
> When double mounting same nfs filesystem, the devname saved in d_fsdata
> will be lost.The second mount should not change the devname that
> be saved in d_fsdata.
> 
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> ---
>  fs/nfs/getroot.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
> index 66984a9..b94f804 100644
> --- a/fs/nfs/getroot.c
> +++ b/fs/nfs/getroot.c
> @@ -120,7 +120,8 @@ struct dentry *nfs_get_root(struct super_block *sb,
> struct nfs_fh *mntfh,
> 
>  	security_d_instantiate(ret, inode);
>  	spin_lock(&ret->d_lock);
> -	if (IS_ROOT(ret) && !(ret->d_flags & DCACHE_NFSFS_RENAMED)) {
> +	if (IS_ROOT(ret) && !ret->d_fsdata &&
> +	    !(ret->d_flags & DCACHE_NFSFS_RENAMED)) {
>  		ret->d_fsdata = name;
>  		name = NULL;
>  	}

Applied. Thanks!
diff mbox

Patch

diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
index 66984a9..b94f804 100644
--- a/fs/nfs/getroot.c
+++ b/fs/nfs/getroot.c
@@ -120,7 +120,8 @@  struct dentry *nfs_get_root(struct super_block *sb,
struct nfs_fh *mntfh,

 	security_d_instantiate(ret, inode);
 	spin_lock(&ret->d_lock);
-	if (IS_ROOT(ret) && !(ret->d_flags & DCACHE_NFSFS_RENAMED)) {
+	if (IS_ROOT(ret) && !ret->d_fsdata &&
+	    !(ret->d_flags & DCACHE_NFSFS_RENAMED)) {
 		ret->d_fsdata = name;
 		name = NULL;