NFS: Fix memroy leak for double mounts
authorKinglong Mee <kinglongmee@gmail.com>
Tue, 15 Apr 2014 09:22:59 +0000 (17:22 +0800)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 15 Apr 2014 14:29:25 +0000 (10:29 -0400)
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>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/getroot.c

index 66984a9aafaad9ad74d81415d5737cbafad81618..b94f80420a584e596789fd048489463728a58789 100644 (file)
@@ -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;
        }