+ proc-smaller-readlock-section-in-readdir-proc.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: proc: smaller readlock section in readdir("/proc")
has been added to the -mm tree.  Its filename is
     proc-smaller-readlock-section-in-readdir-proc.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/proc-smaller-readlock-section-in-readdir-proc.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/proc-smaller-readlock-section-in-readdir-proc.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Alexey Dobriyan <adobriyan@xxxxxxxxx>
Subject: 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@xxxxxxxxx>
Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---


diff -puN fs/proc/generic.c~proc-smaller-readlock-section-in-readdir-proc fs/proc/generic.c
--- a/fs/proc/generic.c~proc-smaller-readlock-section-in-readdir-proc
+++ a/fs/proc/generic.c
@@ -286,9 +286,9 @@ int proc_readdir_de(struct file *file, s
 	if (!dir_emit_dots(file, ctx))
 		return 0;
 
+	i = ctx->pos - 2;
 	read_lock(&proc_subdir_lock);
 	de = pde_subdir_first(de);
-	i = ctx->pos - 2;
 	for (;;) {
 		if (!de) {
 			read_unlock(&proc_subdir_lock);
@@ -309,8 +309,8 @@ int proc_readdir_de(struct file *file, s
 			pde_put(de);
 			return 0;
 		}
-		read_lock(&proc_subdir_lock);
 		ctx->pos++;
+		read_lock(&proc_subdir_lock);
 		next = pde_subdir_next(de);
 		pde_put(de);
 		de = next;
_

Patches currently in -mm which might be from adobriyan@xxxxxxxxx are

proc-condemn-myself-to-maintainers.patch
proc-fixup-pde-allocation-bloat.patch
proc-test-proc-self-symlink.patch
proc-test-proc-thread-self-symlink.patch
proc-smaller-readlock-section-in-readdir-proc.patch
proc-put-task-earlier-in-proc-fail-nth.patch
proc-save-2-atomic-ops-on-write-to-proc-attr.patch
proc-use-macro-in-proc-latency-hook.patch
proc-spread-const-a-bit.patch
proc-use-unsigned-int-in-proc-stat-hook.patch
proc-use-%02u-format.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux