Skip to contentSkip to conversation

proc: smaller RCU section in ->getattr()

PATCH New Alexey Dobriyan 1 participant 1 message Apr 23, 2018 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 proc: smaller RCU section in ->getattr()

struct kstat is thread local.

---

 fs/proc/base.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/proc/base.c +1 -1
@@ -1787,9 +1787,9 @@ int pid_getattr(const struct path *path, struct kstat *stat,
 
 	generic_fillattr(inode, stat);
 
-	rcu_read_lock();
 	stat->uid = GLOBAL_ROOT_UID;
 	stat->gid = GLOBAL_ROOT_GID;
+	rcu_read_lock();
 	task = pid_task(proc_pid(inode), PIDTYPE_PID);
 	if (task) {
 		if (!has_pid_permissions(pid, task, HIDEPID_INVISIBLE)) {