Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
0f9d1a10
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看板
提交
0f9d1a10
编写于
3月 09, 2011
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
expand finish_open() in its only caller
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
5a202bcd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
52 deletion
+38
-52
fs/namei.c
fs/namei.c
+38
-52
未找到文件。
fs/namei.c
浏览文件 @
0f9d1a10
...
...
@@ -2111,57 +2111,6 @@ static int open_will_truncate(int flag, struct inode *inode)
return
(
flag
&
O_TRUNC
);
}
static
struct
file
*
finish_open
(
struct
nameidata
*
nd
,
int
open_flag
,
int
acc_mode
)
{
struct
file
*
filp
;
int
will_truncate
;
int
error
;
will_truncate
=
open_will_truncate
(
open_flag
,
nd
->
path
.
dentry
->
d_inode
);
if
(
will_truncate
)
{
error
=
mnt_want_write
(
nd
->
path
.
mnt
);
if
(
error
)
goto
exit
;
}
error
=
may_open
(
&
nd
->
path
,
acc_mode
,
open_flag
);
if
(
error
)
{
if
(
will_truncate
)
mnt_drop_write
(
nd
->
path
.
mnt
);
goto
exit
;
}
filp
=
nameidata_to_filp
(
nd
);
if
(
!
IS_ERR
(
filp
))
{
error
=
ima_file_check
(
filp
,
acc_mode
);
if
(
error
)
{
fput
(
filp
);
filp
=
ERR_PTR
(
error
);
}
}
if
(
!
IS_ERR
(
filp
))
{
if
(
will_truncate
)
{
error
=
handle_truncate
(
filp
);
if
(
error
)
{
fput
(
filp
);
filp
=
ERR_PTR
(
error
);
}
}
}
/*
* It is now safe to drop the mnt write
* because the filp has had a write taken
* on its behalf.
*/
if
(
will_truncate
)
mnt_drop_write
(
nd
->
path
.
mnt
);
path_put
(
&
nd
->
path
);
return
filp
;
exit:
path_put
(
&
nd
->
path
);
return
ERR_PTR
(
error
);
}
/*
* Handle the last step of open()
*/
...
...
@@ -2169,6 +2118,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
const
struct
open_flags
*
op
,
const
char
*
pathname
)
{
struct
dentry
*
dir
=
nd
->
path
.
dentry
;
int
will_truncate
;
struct
file
*
filp
;
struct
inode
*
inode
;
int
error
;
...
...
@@ -2329,7 +2279,43 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
if
(
S_ISDIR
(
nd
->
inode
->
i_mode
))
goto
exit
;
ok:
filp
=
finish_open
(
nd
,
op
->
open_flag
,
op
->
acc_mode
);
will_truncate
=
open_will_truncate
(
op
->
open_flag
,
nd
->
path
.
dentry
->
d_inode
);
if
(
will_truncate
)
{
error
=
mnt_want_write
(
nd
->
path
.
mnt
);
if
(
error
)
goto
exit
;
}
error
=
may_open
(
&
nd
->
path
,
op
->
acc_mode
,
op
->
open_flag
);
if
(
error
)
{
if
(
will_truncate
)
mnt_drop_write
(
nd
->
path
.
mnt
);
goto
exit
;
}
filp
=
nameidata_to_filp
(
nd
);
if
(
!
IS_ERR
(
filp
))
{
error
=
ima_file_check
(
filp
,
op
->
acc_mode
);
if
(
error
)
{
fput
(
filp
);
filp
=
ERR_PTR
(
error
);
}
}
if
(
!
IS_ERR
(
filp
))
{
if
(
will_truncate
)
{
error
=
handle_truncate
(
filp
);
if
(
error
)
{
fput
(
filp
);
filp
=
ERR_PTR
(
error
);
}
}
}
/*
* It is now safe to drop the mnt write
* because the filp has had a write taken
* on its behalf.
*/
if
(
will_truncate
)
mnt_drop_write
(
nd
->
path
.
mnt
);
path_put
(
&
nd
->
path
);
return
filp
;
exit_mutex_unlock:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录