未验证 提交 1f477c96 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!1165 [sync] PR-1098: proc: allow pid_revalidate() during LOOKUP_RCU

Merge Pull Request from: @openeuler-sync-bot 
 

Origin pull request: 
https://gitee.com/openeuler/kernel/pulls/1098 
 
PR sync from:  Li Nan <linan122@huawei.com>
 https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/thread/4EEIPQOJKUZAK6RIRH5RREOILH6ZD3EC/ 
 
 
Link:https://gitee.com/openeuler/kernel/pulls/1165 

Reviewed-by: zhangyi (F) <yi.zhang@huawei.com> 
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com> 
......@@ -2101,19 +2101,21 @@ static int pid_revalidate(struct dentry *dentry, unsigned int flags)
{
struct inode *inode;
struct task_struct *task;
int ret = 0;
if (flags & LOOKUP_RCU)
return -ECHILD;
inode = d_inode(dentry);
task = get_proc_task(inode);
rcu_read_lock();
inode = d_inode_rcu(dentry);
if (!inode)
goto out;
task = pid_task(proc_pid(inode), PIDTYPE_PID);
if (task) {
pid_update_inode(task, inode);
put_task_struct(task);
return 1;
ret = 1;
}
return 0;
out:
rcu_read_unlock();
return ret;
}
static inline bool proc_inode_is_dead(struct inode *inode)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册