diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2018-08-22 00:54:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-22 13:52:45 -0400 |
commit | 8d48b2e044218ba8b3f6b1d34e96a7474b6b0688 (patch) | |
tree | b649d72c3703bdfa6cc1b0bbedbf861c1476786f | |
parent | 2cd36fb329487e9525db3ccdbac1e92053b646fa (diff) |
proc: smaller readlock section in readdir("/proc")
Readdir context is thread local, so ->pos is thread local,
move it out of readlock.
Link: http://lkml.kernel.org/r/20180627195339.GD18113@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/proc/generic.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index bb1c1625b158..8ae109429a88 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -286,9 +286,9 @@ int proc_readdir_de(struct file *file, struct dir_context *ctx, | |||
286 | if (!dir_emit_dots(file, ctx)) | 286 | if (!dir_emit_dots(file, ctx)) |
287 | return 0; | 287 | return 0; |
288 | 288 | ||
289 | i = ctx->pos - 2; | ||
289 | read_lock(&proc_subdir_lock); | 290 | read_lock(&proc_subdir_lock); |
290 | de = pde_subdir_first(de); | 291 | de = pde_subdir_first(de); |
291 | i = ctx->pos - 2; | ||
292 | for (;;) { | 292 | for (;;) { |
293 | if (!de) { | 293 | if (!de) { |
294 | read_unlock(&proc_subdir_lock); | 294 | read_unlock(&proc_subdir_lock); |
@@ -309,8 +309,8 @@ int proc_readdir_de(struct file *file, struct dir_context *ctx, | |||
309 | pde_put(de); | 309 | pde_put(de); |
310 | return 0; | 310 | return 0; |
311 | } | 311 | } |
312 | read_lock(&proc_subdir_lock); | ||
313 | ctx->pos++; | 312 | ctx->pos++; |
313 | read_lock(&proc_subdir_lock); | ||
314 | next = pde_subdir_next(de); | 314 | next = pde_subdir_next(de); |
315 | pde_put(de); | 315 | pde_put(de); |
316 | de = next; | 316 | de = next; |