linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH Bakeathon version 2 1/1] NFSv4.1: fix hlist_del in _deviceid_purge_client
@ 2011-06-15 14:25 andros
  2011-06-15 14:58 ` Benny Halevy
  2011-06-15 15:01 ` Benny Halevy
  0 siblings, 2 replies; 3+ messages in thread
From: andros @ 2011-06-15 14:25 UTC (permalink / raw)
  To: trond.myklebust; +Cc: linux-nfs, Andy Adamson

From: Andy Adamson <andros@netapp.com>

Signed-off-by: Andy Adamson <andros@netapp.com>
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);
 }
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH Bakeathon version 2 1/1] NFSv4.1: fix hlist_del in _deviceid_purge_client
  2011-06-15 14:25 [PATCH Bakeathon version 2 1/1] NFSv4.1: fix hlist_del in _deviceid_purge_client andros
@ 2011-06-15 14:58 ` Benny Halevy
  2011-06-15 15:01 ` Benny Halevy
  1 sibling, 0 replies; 3+ messages in thread
From: Benny Halevy @ 2011-06-15 14:58 UTC (permalink / raw)
  To: andros; +Cc: trond.myklebust, linux-nfs

On 2011-06-15 10:25, andros@netapp.com wrote:
> From: Andy Adamson <andros@netapp.com>
> 
> Signed-off-by: Andy Adamson <andros@netapp.com>
> cc:stable@kernel.org [2.6.39]

Looks good to me.

Benny

> ---
>  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);
>  }

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH Bakeathon version 2 1/1] NFSv4.1: fix hlist_del in _deviceid_purge_client
  2011-06-15 14:25 [PATCH Bakeathon version 2 1/1] NFSv4.1: fix hlist_del in _deviceid_purge_client andros
  2011-06-15 14:58 ` Benny Halevy
@ 2011-06-15 15:01 ` Benny Halevy
  1 sibling, 0 replies; 3+ messages in thread
From: Benny Halevy @ 2011-06-15 15:01 UTC (permalink / raw)
  To: andros; +Cc: trond.myklebust, linux-nfs

On 2011-06-15 10:25, andros@netapp.com wrote:
> From: Andy Adamson <andros@netapp.com>
> 
> Signed-off-by: Andy Adamson <andros@netapp.com>
> 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);

nit: hlist_del rather than hlist_del_init should be enough here...

Benny

>  		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);
>  }

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-06-15 15:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-15 14:25 [PATCH Bakeathon version 2 1/1] NFSv4.1: fix hlist_del in _deviceid_purge_client andros
2011-06-15 14:58 ` Benny Halevy
2011-06-15 15:01 ` Benny Halevy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).