Skip to contentSkip to conversation

rpc_pipe_msg should be protected by inode->i_lock when purge it.

RFC PATCH In review Bian Naimeng 2 participants 2 messages Sep 14, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 rpc_pipe_msg should be protected by inode->i_lock when purge it.

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

---
 net/sunrpc/rpc_pipe.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/sunrpc/rpc_pipe.c +2 -0
index 8d63f8f..24b2714 100644
@@ -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);
Signature · 7 lines
1.6.5.2



-- 
Regards
Bian Naimeng
#1 lore raw
Quoted 28 lines · Bian Naimeng

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

---
 net/sunrpc/rpc_pipe.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/sunrpc/rpc_pipe.c +2 -0
index 8d63f8f..24b2714 100644
@@ -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);
Signature · 1 line
1.6.5.2

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

Trond