linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH] rpc_pipe_msg should be protected by inode->i_lock when purge it.
@ 2010-09-14  8:59 Bian Naimeng
  2010-09-14 12:58 ` Trond Myklebust
  0 siblings, 1 reply; 2+ messages in thread
From: Bian Naimeng @ 2010-09-14  8:59 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-nfs

Maybe rpc_pipe_msg should be protected by inode->i_lock when purge the free_list.

Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>

---
 net/sunrpc/rpc_pipe.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 8d63f8f..24b2714 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -47,8 +47,10 @@ static void rpc_purge_list(struct rpc_inode *rpci, struct list_head *head,
 		return;
 	do {
 		msg = list_entry(head->next, struct rpc_pipe_msg, list);
+		spin_lock(&rpci->vfs_inode->i_lock);
 		list_del(&msg->list);
 		msg->errno = err;
+		spin_unlock(&rpci->vfs_inode->i_lock);
 		destroy_msg(msg);
 	} while (!list_empty(head));
 	wake_up(&rpci->waitq);
-- 
1.6.5.2



-- 
Regards
Bian Naimeng


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

* Re: [RFC][PATCH] rpc_pipe_msg should be protected by inode->i_lock when purge it.
  2010-09-14  8:59 [RFC][PATCH] rpc_pipe_msg should be protected by inode->i_lock when purge it Bian Naimeng
@ 2010-09-14 12:58 ` Trond Myklebust
  0 siblings, 0 replies; 2+ messages in thread
From: Trond Myklebust @ 2010-09-14 12:58 UTC (permalink / raw)
  To: Bian Naimeng; +Cc: linux-nfs

On Tue, 2010-09-14 at 16:59 +0800, Bian Naimeng wrote:
> Maybe rpc_pipe_msg should be protected by inode->i_lock when purge the free_list.
> 
> Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
> 
> ---
>  net/sunrpc/rpc_pipe.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
> index 8d63f8f..24b2714 100644
> --- a/net/sunrpc/rpc_pipe.c
> +++ b/net/sunrpc/rpc_pipe.c
> @@ -47,8 +47,10 @@ static void rpc_purge_list(struct rpc_inode *rpci, struct list_head *head,
>  		return;
>  	do {
>  		msg = list_entry(head->next, struct rpc_pipe_msg, list);
> +		spin_lock(&rpci->vfs_inode->i_lock);
>  		list_del(&msg->list);
>  		msg->errno = err;
> +		spin_unlock(&rpci->vfs_inode->i_lock);
>  		destroy_msg(msg);
>  	} while (!list_empty(head));
>  	wake_up(&rpci->waitq);
> -- 
> 1.6.5.2
> 
> 
> 

No, we don't need to protect the list 'head'.

Trond

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

end of thread, other threads:[~2010-09-14 13:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-14  8:59 [RFC][PATCH] rpc_pipe_msg should be protected by inode->i_lock when purge it Bian Naimeng
2010-09-14 12:58 ` Trond Myklebust

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).