From patchwork Tue Apr 15 09:22:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 3990201 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 798819F2BA for ; Tue, 15 Apr 2014 09:23:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BAF4D2020F for ; Tue, 15 Apr 2014 09:23:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E2F3920125 for ; Tue, 15 Apr 2014 09:23:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752340AbaDOJXc (ORCPT ); Tue, 15 Apr 2014 05:23:32 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:51567 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751403AbaDOJX2 (ORCPT ); Tue, 15 Apr 2014 05:23:28 -0400 Received: by mail-pa0-f48.google.com with SMTP id hz1so9369995pad.21 for ; Tue, 15 Apr 2014 02:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=u9+HUzxHuATiF/vz1W/wTdP25VUchGSLgUITlYDYuxA=; b=NY2iOPKTmUys0MCK79x6ZEcHYbi6YtgvZZ5t2HCR5noo4sWgKj3TVBSrVekAtyWndK Zd2X45OF2Issbr2ZLzKyPEwBcqrEyk/Vb/7z3Q+JUu5hGXDjEnpahErhlLQqYnAHJQqY jWUNvtMscTTUmTdw7qvJDVu1BaKJWIUeLdLSpyggBRycPrfx0HqrCZCKB5+UJzbE2qqA JIedZXLMPtBAj9gTrXsfOZORy/Rc/4tqL/+D9Ch7jswh6d/vU+1M9N2LBLXTNiKkofP6 UWZQfB4tptFrwfkBJzjFumOWGtxLUQ+Jl0VhfdjrKLuRB1b2RZEbOKaNYLqm8phNDIdK mUnw== X-Received: by 10.68.239.137 with SMTP id vs9mr788001pbc.84.1397553808282; Tue, 15 Apr 2014 02:23:28 -0700 (PDT) Received: from [192.168.0.102] ([171.208.185.170]) by mx.google.com with ESMTPSA id fk4sm92938587pab.23.2014.04.15.02.23.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Apr 2014 02:23:27 -0700 (PDT) Message-ID: <534CFA73.4040801@gmail.com> Date: Tue, 15 Apr 2014 17:22:59 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Trond Myklebust , Alexander Viro CC: linux-nfs@vger.kernel.org Subject: [PATCH] NFS: Fix memroy leak for double mounts Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;