From patchwork Wed Jun 15 14:25:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Adamson X-Patchwork-Id: 882192 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5FEOwll028635 for ; Wed, 15 Jun 2011 14:24:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755191Ab1FOOY5 (ORCPT ); Wed, 15 Jun 2011 10:24:57 -0400 Received: from mx2.netapp.com ([216.240.18.37]:32923 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754947Ab1FOOY5 (ORCPT ); Wed, 15 Jun 2011 10:24:57 -0400 X-IronPort-AV: E=Sophos;i="4.65,370,1304319600"; d="scan'208";a="555757240" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx2-out.netapp.com with ESMTP; 15 Jun 2011 07:24:57 -0700 Received: from localhost.localdomain (neralla-lxp.hq.netapp.com [10.55.73.114] (may be forged)) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id p5FEOu4h012977; Wed, 15 Jun 2011 07:24:56 -0700 (PDT) From: andros@netapp.com To: trond.myklebust@netapp.com Cc: linux-nfs@vger.kernel.org, Andy Adamson Subject: [PATCH Bakeathon version 2 1/1] NFSv4.1: fix hlist_del in _deviceid_purge_client Date: Wed, 15 Jun 2011 10:25:10 -0400 Message-Id: <1308147910-17057-1-git-send-email-andros@netapp.com> X-Mailer: git-send-email 1.6.6 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 15 Jun 2011 14:24:59 +0000 (UTC) From: Andy Adamson Signed-off-by: Andy Adamson cc:stable@kernel.org [2.6.39] --- fs/nfs/inode.c | 2 ++ fs/nfs/pnfs.h | 1 + fs/nfs/pnfs_dev.c | 14 +++++++++++++- 3 files changed, 16 insertions(+), 1 deletions(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 6f4850d..55ba1b0 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -1595,6 +1595,8 @@ static int __init init_nfs_fs(void) if (err) goto out0; + nfs4_init_deviceid_cache(); + #ifdef CONFIG_PROC_FS rpc_proc_register(&nfs_rpcstat); #endif diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index e46edac..67400bc 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h @@ -212,6 +212,7 @@ void nfs4_init_deviceid_node(struct nfs4_deviceid_node *, struct nfs4_deviceid_node *nfs4_insert_deviceid_node(struct nfs4_deviceid_node *); bool nfs4_put_deviceid_node(struct nfs4_deviceid_node *); void nfs4_deviceid_purge_client(const struct nfs_client *); +void nfs4_init_deviceid_cache(void); static inline int lo_fail_bit(u32 iomode) { diff --git a/fs/nfs/pnfs_dev.c b/fs/nfs/pnfs_dev.c index 037a5c6..923a9da 100644 --- a/fs/nfs/pnfs_dev.c +++ b/fs/nfs/pnfs_dev.c @@ -161,6 +161,15 @@ nfs4_init_deviceid_node(struct nfs4_deviceid_node *d, } EXPORT_SYMBOL_GPL(nfs4_init_deviceid_node); +void +nfs4_init_deviceid_cache() +{ + long h; + + for (h = 0; h < NFS4_DEVICE_ID_HASH_SIZE; h++) + INIT_HLIST_HEAD(&nfs4_deviceid_cache[h]); +} + /* * Uniquely initialize and insert a deviceid node into cache * @@ -236,9 +245,10 @@ _deviceid_purge_client(const struct nfs_client *clp, long hash) synchronize_rcu(); while (!hlist_empty(&tmp)) { + d = hlist_entry(tmp.first, struct nfs4_deviceid_node, tmpnode); + hlist_del_init(&d->tmpnode); if (atomic_dec_and_test(&d->ref)) d->ld->free_deviceid_node(d); - hlist_del_init(&d->tmpnode); } } @@ -247,6 +257,8 @@ nfs4_deviceid_purge_client(const struct nfs_client *clp) { long h; + if (!(clp->cl_exchange_flags & EXCHGID4_FLAG_USE_PNFS_MDS)) + return; for (h = 0; h < NFS4_DEVICE_ID_HASH_SIZE; h++) _deviceid_purge_client(clp, h); }