Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
5f380c7f
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
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看板
提交
5f380c7f
编写于
4月 07, 2015
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lift generic_write_checks() into callers of __generic_file_write_iter()
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
0b8def9d
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
60 addition
and
30 deletion
+60
-30
fs/block_dev.c
fs/block_dev.c
+10
-0
fs/cifs/file.c
fs/cifs/file.c
+23
-16
fs/ext4/file.c
fs/ext4/file.c
+11
-3
fs/udf/file.c
fs/udf/file.c
+10
-0
mm/filemap.c
mm/filemap.c
+6
-11
未找到文件。
fs/block_dev.c
浏览文件 @
5f380c7f
...
...
@@ -1597,6 +1597,16 @@ ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
struct
file
*
file
=
iocb
->
ki_filp
;
struct
blk_plug
plug
;
ssize_t
ret
;
size_t
count
=
iov_iter_count
(
from
);
ret
=
generic_write_checks
(
file
,
&
iocb
->
ki_pos
,
&
count
,
1
);
if
(
ret
)
return
ret
;
if
(
count
==
0
)
return
0
;
iov_iter_truncate
(
from
,
count
);
blk_start_plug
(
&
plug
);
ret
=
__generic_file_write_iter
(
iocb
,
from
);
...
...
fs/cifs/file.c
浏览文件 @
5f380c7f
...
...
@@ -2673,8 +2673,8 @@ cifs_writev(struct kiocb *iocb, struct iov_iter *from)
struct
inode
*
inode
=
file
->
f_mapping
->
host
;
struct
cifsInodeInfo
*
cinode
=
CIFS_I
(
inode
);
struct
TCP_Server_Info
*
server
=
tlink_tcon
(
cfile
->
tlink
)
->
ses
->
server
;
ssize_t
rc
=
-
EACCES
;
loff_t
lock_pos
=
iocb
->
ki_pos
;
ssize_t
rc
;
size_t
count
;
/*
* We need to hold the sem to be sure nobody modifies lock list
...
...
@@ -2682,24 +2682,31 @@ cifs_writev(struct kiocb *iocb, struct iov_iter *from)
*/
down_read
(
&
cinode
->
lock_sem
);
mutex_lock
(
&
inode
->
i_mutex
);
if
(
file
->
f_flags
&
O_APPEND
)
lock_pos
=
i_size_read
(
inode
);
if
(
!
cifs_find_lock_conflict
(
cfile
,
lock_pos
,
iov_iter_count
(
from
),
count
=
iov_iter_count
(
from
);
rc
=
generic_write_checks
(
file
,
&
iocb
->
ki_pos
,
&
count
,
0
);
if
(
rc
)
goto
out
;
if
(
count
==
0
)
goto
out
;
iov_iter_truncate
(
from
,
count
);
if
(
!
cifs_find_lock_conflict
(
cfile
,
iocb
->
ki_pos
,
iov_iter_count
(
from
),
server
->
vals
->
exclusive_lock_type
,
NULL
,
CIFS_WRITE_OP
))
{
CIFS_WRITE_OP
))
rc
=
__generic_file_write_iter
(
iocb
,
from
);
else
rc
=
-
EACCES
;
out:
mutex_unlock
(
&
inode
->
i_mutex
);
if
(
rc
>
0
)
{
ssize_t
err
;
err
=
generic_write_sync
(
file
,
iocb
->
ki_pos
-
rc
,
rc
);
ssize_t
err
=
generic_write_sync
(
file
,
iocb
->
ki_pos
-
rc
,
rc
);
if
(
err
<
0
)
rc
=
err
;
}
}
else
{
mutex_unlock
(
&
inode
->
i_mutex
);
}
up_read
(
&
cinode
->
lock_sem
);
return
rc
;
}
...
...
fs/ext4/file.c
浏览文件 @
5f380c7f
...
...
@@ -132,9 +132,8 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
ret
=
-
EFBIG
;
goto
errout
;
}
if
(
pos
+
length
>
sbi
->
s_bitmap_maxbytes
)
iov_iter_truncate
(
from
,
sbi
->
s_bitmap_maxbytes
-
pos
);
length
=
iov_iter_count
(
from
);
}
iocb
->
private
=
&
overwrite
;
...
...
@@ -172,7 +171,16 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
}
}
ret
=
generic_write_checks
(
file
,
&
iocb
->
ki_pos
,
&
length
,
0
);
if
(
ret
)
goto
out
;
if
(
length
==
0
)
goto
out
;
iov_iter_truncate
(
from
,
length
);
ret
=
__generic_file_write_iter
(
iocb
,
from
);
out:
mutex_unlock
(
&
inode
->
i_mutex
);
if
(
ret
>
0
)
{
...
...
fs/udf/file.c
浏览文件 @
5f380c7f
...
...
@@ -151,7 +151,17 @@ static ssize_t udf_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
}
else
up_write
(
&
iinfo
->
i_data_sem
);
retval
=
generic_write_checks
(
file
,
&
iocb
->
ki_pos
,
&
count
,
0
);
if
(
retval
)
goto
out
;
if
(
count
==
0
)
goto
out
;
iov_iter_truncate
(
from
,
count
);
retval
=
__generic_file_write_iter
(
iocb
,
from
);
out:
mutex_unlock
(
&
inode
->
i_mutex
);
if
(
retval
>
0
)
{
...
...
mm/filemap.c
浏览文件 @
5f380c7f
...
...
@@ -2560,19 +2560,9 @@ ssize_t __generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
ssize_t
written
=
0
;
ssize_t
err
;
ssize_t
status
;
size_t
count
=
iov_iter_count
(
from
);
/* We can write back this queue in page reclaim */
current
->
backing_dev_info
=
inode_to_bdi
(
inode
);
err
=
generic_write_checks
(
file
,
&
iocb
->
ki_pos
,
&
count
,
S_ISBLK
(
inode
->
i_mode
));
if
(
err
)
goto
out
;
if
(
count
==
0
)
goto
out
;
iov_iter_truncate
(
from
,
count
);
err
=
file_remove_suid
(
file
);
if
(
err
)
goto
out
;
...
...
@@ -2651,9 +2641,14 @@ ssize_t generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
struct
file
*
file
=
iocb
->
ki_filp
;
struct
inode
*
inode
=
file
->
f_mapping
->
host
;
ssize_t
ret
;
size_t
count
=
iov_iter_count
(
from
);
mutex_lock
(
&
inode
->
i_mutex
);
ret
=
generic_write_checks
(
file
,
&
iocb
->
ki_pos
,
&
count
,
0
);
if
(
!
ret
&&
count
)
{
iov_iter_truncate
(
from
,
count
);
ret
=
__generic_file_write_iter
(
iocb
,
from
);
}
mutex_unlock
(
&
inode
->
i_mutex
);
if
(
ret
>
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录