From: Kinglong Mee Date: Tue, 15 Apr 2014 09:22:59 +0000 (+0800) Subject: NFS: Fix memroy leak for double mounts X-Git-Tag: next-20140428~62^2~2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4dfc7fdb9e261d77818616782ae1841a80e0fc83;p=karo-tx-linux.git NFS: Fix memroy leak for double mounts 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 Signed-off-by: Trond Myklebust --- diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c index 66984a9aafaa..b94f80420a58 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; }