summaryrefslogtreecommitdiff
path: root/fs/kernfs/symlink.c
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2021-07-16 17:28:29 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-27 09:29:15 +0200
commit7ba0273b2f34a55efe967d3c7381fb1da2ca195f (patch)
treeb8c0df46d2918cd7fc27c87fa1f9e058bbfd6aeb /fs/kernfs/symlink.c
parentc7e7c04274b13f98f758fb69b03f2ab61976ea80 (diff)
kernfs: switch kernfs to use an rwsem
The kernfs global lock restricts the ability to perform kernfs node lookup operations in parallel during path walks. Change the kernfs mutex to an rwsem so that, when opportunity arises, node searches can be done in parallel with path walk lookups. Reviewed-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Ian Kent <raven@themaw.net> Link: https://lore.kernel.org/r/162642770946.63632.2218304587223241374.stgit@web.messagingengine.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs/symlink.c')
-rw-r--r--fs/kernfs/symlink.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/kernfs/symlink.c b/fs/kernfs/symlink.c
index 5432883d819f..c8f8e41b8411 100644
--- a/fs/kernfs/symlink.c
+++ b/fs/kernfs/symlink.c
@@ -116,9 +116,9 @@ static int kernfs_getlink(struct inode *inode, char *path)
struct kernfs_node *target = kn->symlink.target_kn;
int error;
- mutex_lock(&kernfs_mutex);
+ down_read(&kernfs_rwsem);
error = kernfs_get_target_path(parent, target, path);
- mutex_unlock(&kernfs_mutex);
+ up_read(&kernfs_rwsem);
return error;
}