lkml.org 
[lkml]   [2014]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 2/2] fs/namespace: use RCU list functions for mnt_hash
From
Date
mount.mnt_hash is RCU-protected, and therefore we must use the RCU
variants to manipulate the list.

Signed-off-by: Max Kellermann <mk@cm4all.com>
---
fs/namespace.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 2aa0a14..295a0c0 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -22,6 +22,7 @@
#include <linux/fsnotify.h> /* fsnotify_vfsmount_delete */
#include <linux/uaccess.h>
#include <linux/proc_ns.h>
+#include <linux/rculist.h>
#include <linux/magic.h>
#include "pnode.h"
#include "internal.h"
@@ -739,8 +740,8 @@ static void attach_mnt(struct mount *mnt,
struct mountpoint *mp)
{
mnt_set_mountpoint(parent, mp, mnt);
- list_add_tail(&mnt->mnt_hash, mount_hashtable +
- hash(&parent->mnt, mp->m_dentry));
+ list_add_tail_rcu(&mnt->mnt_hash, mount_hashtable +
+ hash(&parent->mnt, mp->m_dentry));
list_add_tail(&mnt->mnt_child, &parent->mnt_mounts);
}

@@ -762,8 +763,8 @@ static void commit_tree(struct mount *mnt)

list_splice(&head, n->list.prev);

- list_add_tail(&mnt->mnt_hash, mount_hashtable +
- hash(&parent->mnt, mnt->mnt_mountpoint));
+ list_add_tail_rcu(&mnt->mnt_hash, mount_hashtable +
+ hash(&parent->mnt, mnt->mnt_mountpoint));
list_add_tail(&mnt->mnt_child, &parent->mnt_mounts);
touch_mnt_namespace(n);
}


\
 
 \ /
  Last update: 2014-03-19 22:41    [W:0.051 / U:0.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site