Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
1ab59738
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1ab59738
编写于
11月 24, 2011
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vfs: spread struct mount - do_umount/propagate_mount_busy
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
44d964d6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
23 deletion
+23
-23
fs/namespace.c
fs/namespace.c
+14
-14
fs/pnode.c
fs/pnode.c
+8
-8
fs/pnode.h
fs/pnode.h
+1
-1
未找到文件。
fs/namespace.c
浏览文件 @
1ab59738
...
...
@@ -1180,7 +1180,7 @@ int may_umount(struct vfsmount *mnt)
int
ret
=
1
;
down_read
(
&
namespace_sem
);
br_write_lock
(
vfsmount_lock
);
if
(
propagate_mount_busy
(
mnt
,
2
))
if
(
propagate_mount_busy
(
real_mount
(
mnt
)
,
2
))
ret
=
0
;
br_write_unlock
(
vfsmount_lock
);
up_read
(
&
namespace_sem
);
...
...
@@ -1246,13 +1246,13 @@ void umount_tree(struct mount *mnt, int propagate, struct list_head *kill)
static
void
shrink_submounts
(
struct
mount
*
mnt
,
struct
list_head
*
umounts
);
static
int
do_umount
(
struct
vfs
mount
*
mnt
,
int
flags
)
static
int
do_umount
(
struct
mount
*
mnt
,
int
flags
)
{
struct
super_block
*
sb
=
mnt
->
mnt_sb
;
struct
super_block
*
sb
=
mnt
->
mnt
.
mnt
_sb
;
int
retval
;
LIST_HEAD
(
umount_list
);
retval
=
security_sb_umount
(
mnt
,
flags
);
retval
=
security_sb_umount
(
&
mnt
->
mnt
,
flags
);
if
(
retval
)
return
retval
;
...
...
@@ -1263,7 +1263,7 @@ static int do_umount(struct vfsmount *mnt, int flags)
* (2) the usage count == 1 [parent vfsmount] + 1 [sys_umount]
*/
if
(
flags
&
MNT_EXPIRE
)
{
if
(
mnt
==
current
->
fs
->
root
.
mnt
||
if
(
&
mnt
->
mnt
==
current
->
fs
->
root
.
mnt
||
flags
&
(
MNT_FORCE
|
MNT_DETACH
))
return
-
EINVAL
;
...
...
@@ -1272,13 +1272,13 @@ static int do_umount(struct vfsmount *mnt, int flags)
* all race cases, but it's a slowpath.
*/
br_write_lock
(
vfsmount_lock
);
if
(
mnt_get_count
(
mnt
)
!=
2
)
{
if
(
mnt_get_count
(
&
mnt
->
mnt
)
!=
2
)
{
br_write_unlock
(
vfsmount_lock
);
return
-
EBUSY
;
}
br_write_unlock
(
vfsmount_lock
);
if
(
!
xchg
(
&
mnt
->
mnt_expiry_mark
,
1
))
if
(
!
xchg
(
&
mnt
->
mnt
.
mnt
_expiry_mark
,
1
))
return
-
EAGAIN
;
}
...
...
@@ -1305,7 +1305,7 @@ static int do_umount(struct vfsmount *mnt, int flags)
* /reboot - static binary that would close all descriptors and
* call reboot(9). Then init(8) could umount root and exec /reboot.
*/
if
(
mnt
==
current
->
fs
->
root
.
mnt
&&
!
(
flags
&
MNT_DETACH
))
{
if
(
&
mnt
->
mnt
==
current
->
fs
->
root
.
mnt
&&
!
(
flags
&
MNT_DETACH
))
{
/*
* Special case for "unmounting" root ...
* we just try to remount it readonly.
...
...
@@ -1322,12 +1322,12 @@ static int do_umount(struct vfsmount *mnt, int flags)
event
++
;
if
(
!
(
flags
&
MNT_DETACH
))
shrink_submounts
(
real_mount
(
mnt
)
,
&
umount_list
);
shrink_submounts
(
mnt
,
&
umount_list
);
retval
=
-
EBUSY
;
if
(
flags
&
MNT_DETACH
||
!
propagate_mount_busy
(
mnt
,
2
))
{
if
(
!
list_empty
(
&
mnt
->
mnt_list
))
umount_tree
(
real_mount
(
mnt
)
,
1
,
&
umount_list
);
if
(
!
list_empty
(
&
mnt
->
mnt
.
mnt
_list
))
umount_tree
(
mnt
,
1
,
&
umount_list
);
retval
=
0
;
}
br_write_unlock
(
vfsmount_lock
);
...
...
@@ -1369,7 +1369,7 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
if
(
!
capable
(
CAP_SYS_ADMIN
))
goto
dput_and_out
;
retval
=
do_umount
(
path
.
mnt
,
flags
);
retval
=
do_umount
(
real_mount
(
path
.
mnt
)
,
flags
);
dput_and_out:
/* we mustn't call path_put() as that would clear mnt_expiry_mark */
dput
(
path
.
dentry
);
...
...
@@ -2101,7 +2101,7 @@ void mark_mounts_for_expiry(struct list_head *mounts)
*/
list_for_each_entry_safe
(
mnt
,
next
,
mounts
,
mnt
.
mnt_expire
)
{
if
(
!
xchg
(
&
mnt
->
mnt
.
mnt_expiry_mark
,
1
)
||
propagate_mount_busy
(
&
mnt
->
mnt
,
1
))
propagate_mount_busy
(
mnt
,
1
))
continue
;
list_move
(
&
mnt
->
mnt
.
mnt_expire
,
&
graveyard
);
}
...
...
@@ -2148,7 +2148,7 @@ static int select_submounts(struct mount *parent, struct list_head *graveyard)
goto
repeat
;
}
if
(
!
propagate_mount_busy
(
&
mnt
->
mnt
,
1
))
{
if
(
!
propagate_mount_busy
(
mnt
,
1
))
{
list_move_tail
(
&
mnt
->
mnt
.
mnt_expire
,
graveyard
);
found
++
;
}
...
...
fs/pnode.c
浏览文件 @
1ab59738
...
...
@@ -272,9 +272,9 @@ int propagate_mnt(struct vfsmount *dest_mnt, struct dentry *dest_dentry,
/*
* return true if the refcount is greater than count
*/
static
inline
int
do_refcount_check
(
struct
vfs
mount
*
mnt
,
int
count
)
static
inline
int
do_refcount_check
(
struct
mount
*
mnt
,
int
count
)
{
int
mycount
=
mnt_get_count
(
mnt
)
-
mnt
->
mnt_ghosts
;
int
mycount
=
mnt_get_count
(
&
mnt
->
mnt
)
-
mnt
->
mnt
.
mnt_ghosts
;
return
(
mycount
>
count
);
}
...
...
@@ -288,14 +288,14 @@ static inline int do_refcount_check(struct vfsmount *mnt, int count)
*
* vfsmount lock must be held for write
*/
int
propagate_mount_busy
(
struct
vfs
mount
*
mnt
,
int
refcnt
)
int
propagate_mount_busy
(
struct
mount
*
mnt
,
int
refcnt
)
{
struct
vfsmount
*
m
;
struct
mount
*
child
;
struct
vfsmount
*
parent
=
mnt
->
mnt_parent
;
struct
vfsmount
*
parent
=
mnt
->
mnt
.
mnt
_parent
;
int
ret
=
0
;
if
(
mnt
==
parent
)
if
(
&
mnt
->
mnt
==
parent
)
return
do_refcount_check
(
mnt
,
refcnt
);
/*
...
...
@@ -303,14 +303,14 @@ int propagate_mount_busy(struct vfsmount *mnt, int refcnt)
* If not, we don't have to go checking for all other
* mounts
*/
if
(
!
list_empty
(
&
mnt
->
mnt_mounts
)
||
do_refcount_check
(
mnt
,
refcnt
))
if
(
!
list_empty
(
&
mnt
->
mnt
.
mnt
_mounts
)
||
do_refcount_check
(
mnt
,
refcnt
))
return
1
;
for
(
m
=
propagation_next
(
parent
,
parent
);
m
;
m
=
propagation_next
(
m
,
parent
))
{
child
=
__lookup_mnt
(
m
,
mnt
->
mnt_mountpoint
,
0
);
child
=
__lookup_mnt
(
m
,
mnt
->
mnt
.
mnt
_mountpoint
,
0
);
if
(
child
&&
list_empty
(
&
child
->
mnt
.
mnt_mounts
)
&&
(
ret
=
do_refcount_check
(
&
child
->
mnt
,
1
)))
(
ret
=
do_refcount_check
(
child
,
1
)))
break
;
}
return
ret
;
...
...
fs/pnode.h
浏览文件 @
1ab59738
...
...
@@ -33,7 +33,7 @@ void change_mnt_propagation(struct mount *, int);
int
propagate_mnt
(
struct
vfsmount
*
,
struct
dentry
*
,
struct
vfsmount
*
,
struct
list_head
*
);
int
propagate_umount
(
struct
list_head
*
);
int
propagate_mount_busy
(
struct
vfs
mount
*
,
int
);
int
propagate_mount_busy
(
struct
mount
*
,
int
);
void
mnt_release_group_id
(
struct
mount
*
);
int
get_dominating_id
(
struct
vfsmount
*
mnt
,
const
struct
path
*
root
);
unsigned
int
mnt_get_count
(
struct
vfsmount
*
mnt
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录