Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
419148da
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
419148da
编写于
11月 24, 2011
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vfs: spread struct mount - attach_mnt/detach_mnt
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
315fc83e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
19 deletion
+22
-19
fs/namespace.c
fs/namespace.c
+22
-19
未找到文件。
fs/namespace.c
浏览文件 @
419148da
...
@@ -556,14 +556,14 @@ static void dentry_reset_mounted(struct dentry *dentry)
...
@@ -556,14 +556,14 @@ static void dentry_reset_mounted(struct dentry *dentry)
/*
/*
* vfsmount lock must be held for write
* vfsmount lock must be held for write
*/
*/
static
void
detach_mnt
(
struct
vfs
mount
*
mnt
,
struct
path
*
old_path
)
static
void
detach_mnt
(
struct
mount
*
mnt
,
struct
path
*
old_path
)
{
{
old_path
->
dentry
=
mnt
->
mnt_mountpoint
;
old_path
->
dentry
=
mnt
->
mnt
.
mnt
_mountpoint
;
old_path
->
mnt
=
mnt
->
mnt_parent
;
old_path
->
mnt
=
mnt
->
mnt
.
mnt
_parent
;
mnt
->
mnt
_parent
=
mnt
;
mnt
->
mnt
.
mnt_parent
=
&
mnt
->
mnt
;
mnt
->
mnt
_mountpoint
=
mnt
->
mnt_root
;
mnt
->
mnt
.
mnt_mountpoint
=
mnt
->
mnt
.
mnt_root
;
list_del_init
(
&
mnt
->
mnt_child
);
list_del_init
(
&
mnt
->
mnt
.
mnt
_child
);
list_del_init
(
&
mnt
->
mnt_hash
);
list_del_init
(
&
mnt
->
mnt
.
mnt
_hash
);
dentry_reset_mounted
(
old_path
->
dentry
);
dentry_reset_mounted
(
old_path
->
dentry
);
}
}
...
@@ -583,12 +583,12 @@ void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry,
...
@@ -583,12 +583,12 @@ void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry,
/*
/*
* vfsmount lock must be held for write
* vfsmount lock must be held for write
*/
*/
static
void
attach_mnt
(
struct
vfs
mount
*
mnt
,
struct
path
*
path
)
static
void
attach_mnt
(
struct
mount
*
mnt
,
struct
path
*
path
)
{
{
mnt_set_mountpoint
(
path
->
mnt
,
path
->
dentry
,
mnt
);
mnt_set_mountpoint
(
path
->
mnt
,
path
->
dentry
,
&
mnt
->
mnt
);
list_add_tail
(
&
mnt
->
mnt_hash
,
mount_hashtable
+
list_add_tail
(
&
mnt
->
mnt
.
mnt
_hash
,
mount_hashtable
+
hash
(
path
->
mnt
,
path
->
dentry
));
hash
(
path
->
mnt
,
path
->
dentry
));
list_add_tail
(
&
mnt
->
mnt_child
,
&
path
->
mnt
->
mnt_mounts
);
list_add_tail
(
&
mnt
->
mnt
.
mnt
_child
,
&
path
->
mnt
->
mnt_mounts
);
}
}
static
inline
void
__mnt_make_longterm
(
struct
vfsmount
*
mnt
)
static
inline
void
__mnt_make_longterm
(
struct
vfsmount
*
mnt
)
...
@@ -1446,7 +1446,7 @@ struct vfsmount *copy_tree(struct vfsmount *mnt, struct dentry *dentry,
...
@@ -1446,7 +1446,7 @@ struct vfsmount *copy_tree(struct vfsmount *mnt, struct dentry *dentry,
goto
Enomem
;
goto
Enomem
;
br_write_lock
(
vfsmount_lock
);
br_write_lock
(
vfsmount_lock
);
list_add_tail
(
&
q
->
mnt_list
,
&
res
->
mnt_list
);
list_add_tail
(
&
q
->
mnt_list
,
&
res
->
mnt_list
);
attach_mnt
(
q
,
&
path
);
attach_mnt
(
real_mount
(
q
)
,
&
path
);
br_write_unlock
(
vfsmount_lock
);
br_write_unlock
(
vfsmount_lock
);
}
}
}
}
...
@@ -1612,8 +1612,8 @@ static int attach_recursive_mnt(struct vfsmount *source_mnt,
...
@@ -1612,8 +1612,8 @@ static int attach_recursive_mnt(struct vfsmount *source_mnt,
set_mnt_shared
(
&
p
->
mnt
);
set_mnt_shared
(
&
p
->
mnt
);
}
}
if
(
parent_path
)
{
if
(
parent_path
)
{
detach_mnt
(
source_mnt
,
parent_path
);
detach_mnt
(
real_mount
(
source_mnt
)
,
parent_path
);
attach_mnt
(
source_mnt
,
path
);
attach_mnt
(
real_mount
(
source_mnt
)
,
path
);
touch_mnt_namespace
(
parent_path
->
mnt
->
mnt_ns
);
touch_mnt_namespace
(
parent_path
->
mnt
->
mnt_ns
);
}
else
{
}
else
{
mnt_set_mountpoint
(
dest_mnt
,
dest_dentry
,
source_mnt
);
mnt_set_mountpoint
(
dest_mnt
,
dest_dentry
,
source_mnt
);
...
@@ -2600,6 +2600,7 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
...
@@ -2600,6 +2600,7 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
const
char
__user
*
,
put_old
)
const
char
__user
*
,
put_old
)
{
{
struct
path
new
,
old
,
parent_path
,
root_parent
,
root
;
struct
path
new
,
old
,
parent_path
,
root_parent
,
root
;
struct
mount
*
new_mnt
,
*
root_mnt
;
int
error
;
int
error
;
if
(
!
capable
(
CAP_SYS_ADMIN
))
if
(
!
capable
(
CAP_SYS_ADMIN
))
...
@@ -2623,6 +2624,8 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
...
@@ -2623,6 +2624,8 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
goto
out3
;
goto
out3
;
error
=
-
EINVAL
;
error
=
-
EINVAL
;
new_mnt
=
real_mount
(
new
.
mnt
);
root_mnt
=
real_mount
(
root
.
mnt
);
if
(
IS_MNT_SHARED
(
old
.
mnt
)
||
if
(
IS_MNT_SHARED
(
old
.
mnt
)
||
IS_MNT_SHARED
(
new
.
mnt
->
mnt_parent
)
||
IS_MNT_SHARED
(
new
.
mnt
->
mnt_parent
)
||
IS_MNT_SHARED
(
root
.
mnt
->
mnt_parent
))
IS_MNT_SHARED
(
root
.
mnt
->
mnt_parent
))
...
@@ -2651,12 +2654,12 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
...
@@ -2651,12 +2654,12 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
if
(
!
is_path_reachable
(
old
.
mnt
,
old
.
dentry
,
&
new
))
if
(
!
is_path_reachable
(
old
.
mnt
,
old
.
dentry
,
&
new
))
goto
out4
;
goto
out4
;
br_write_lock
(
vfsmount_lock
);
br_write_lock
(
vfsmount_lock
);
detach_mnt
(
new
.
mnt
,
&
parent_path
);
detach_mnt
(
new
_
mnt
,
&
parent_path
);
detach_mnt
(
root
.
mnt
,
&
root_parent
);
detach_mnt
(
root
_
mnt
,
&
root_parent
);
/* mount old root on put_old */
/* mount old root on put_old */
attach_mnt
(
root
.
mnt
,
&
old
);
attach_mnt
(
root
_
mnt
,
&
old
);
/* mount new_root on / */
/* mount new_root on / */
attach_mnt
(
new
.
mnt
,
&
root_parent
);
attach_mnt
(
new
_
mnt
,
&
root_parent
);
touch_mnt_namespace
(
current
->
nsproxy
->
mnt_ns
);
touch_mnt_namespace
(
current
->
nsproxy
->
mnt_ns
);
br_write_unlock
(
vfsmount_lock
);
br_write_unlock
(
vfsmount_lock
);
chroot_fs_refs
(
&
root
,
&
new
);
chroot_fs_refs
(
&
root
,
&
new
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录