Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
643822b4
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
643822b4
编写于
11月 24, 2011
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vfs: spread struct mount - is_path_reachable
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
676da58d
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
13 addition
and
13 deletion
+13
-13
fs/namespace.c
fs/namespace.c
+7
-7
fs/pnode.c
fs/pnode.c
+5
-5
fs/pnode.h
fs/pnode.h
+1
-1
未找到文件。
fs/namespace.c
浏览文件 @
643822b4
...
...
@@ -2559,21 +2559,21 @@ SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
*
* namespace_sem or vfsmount_lock is held
*/
bool
is_path_reachable
(
struct
vfs
mount
*
mnt
,
struct
dentry
*
dentry
,
bool
is_path_reachable
(
struct
mount
*
mnt
,
struct
dentry
*
dentry
,
const
struct
path
*
root
)
{
while
(
mnt
!=
root
->
mnt
&&
mnt_has_parent
(
real_mount
(
mnt
)
))
{
dentry
=
mnt
->
mnt_mountpoint
;
mnt
=
mnt
->
mnt_parent
;
while
(
&
mnt
->
mnt
!=
root
->
mnt
&&
mnt_has_parent
(
mnt
))
{
dentry
=
mnt
->
mnt
.
mnt
_mountpoint
;
mnt
=
real_mount
(
mnt
->
mnt
.
mnt_parent
)
;
}
return
mnt
==
root
->
mnt
&&
is_subdir
(
dentry
,
root
->
dentry
);
return
&
mnt
->
mnt
==
root
->
mnt
&&
is_subdir
(
dentry
,
root
->
dentry
);
}
int
path_is_under
(
struct
path
*
path1
,
struct
path
*
path2
)
{
int
res
;
br_read_lock
(
vfsmount_lock
);
res
=
is_path_reachable
(
path1
->
mnt
,
path1
->
dentry
,
path2
);
res
=
is_path_reachable
(
real_mount
(
path1
->
mnt
)
,
path1
->
dentry
,
path2
);
br_read_unlock
(
vfsmount_lock
);
return
res
;
}
...
...
@@ -2659,7 +2659,7 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
if
(
!
mnt_has_parent
(
new_mnt
))
goto
out4
;
/* not attached */
/* make sure we can reach put_old from new_root */
if
(
!
is_path_reachable
(
old
.
mnt
,
old
.
dentry
,
&
new
))
if
(
!
is_path_reachable
(
real_mount
(
old
.
mnt
)
,
old
.
dentry
,
&
new
))
goto
out4
;
br_write_lock
(
vfsmount_lock
);
detach_mnt
(
new_mnt
,
&
parent_path
);
...
...
fs/pnode.c
浏览文件 @
643822b4
...
...
@@ -32,15 +32,15 @@ static struct vfsmount *get_peer_under_root(struct vfsmount *mnt,
struct
mnt_namespace
*
ns
,
const
struct
path
*
root
)
{
struct
vfsmount
*
m
=
mnt
;
struct
mount
*
m
=
real_mount
(
mnt
)
;
do
{
/* Check the namespace first for optimization */
if
(
m
->
mnt
_ns
==
ns
&&
is_path_reachable
(
m
,
m
->
mnt_root
,
root
))
return
m
;
if
(
m
->
mnt
.
mnt_ns
==
ns
&&
is_path_reachable
(
m
,
m
->
mnt
.
mnt_root
,
root
))
return
&
m
->
mnt
;
m
=
next_peer
(
m
);
}
while
(
m
!=
mnt
);
m
=
real_mount
(
next_peer
(
&
m
->
mnt
)
);
}
while
(
&
m
->
mnt
!=
mnt
);
return
NULL
;
}
...
...
fs/pnode.h
浏览文件 @
643822b4
...
...
@@ -42,6 +42,6 @@ void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
void
release_mounts
(
struct
list_head
*
);
void
umount_tree
(
struct
mount
*
,
int
,
struct
list_head
*
);
struct
mount
*
copy_tree
(
struct
mount
*
,
struct
dentry
*
,
int
);
bool
is_path_reachable
(
struct
vfs
mount
*
,
struct
dentry
*
,
bool
is_path_reachable
(
struct
mount
*
,
struct
dentry
*
,
const
struct
path
*
root
);
#endif
/* _LINUX_PNODE_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录