Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
7ba52631
L
linux
项目概览
xiphi1978
/
linux
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7ba52631
编写于
2月 08, 2007
作者:
S
Steve French
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CIFS] Allow update of EOF on remote extend of file
Signed-off-by:
N
Steve French
<
sfrench@us.ibm.com
>
上级
595dcfec
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
11 addition
and
8 deletion
+11
-8
fs/cifs/cifsproto.h
fs/cifs/cifsproto.h
+1
-1
fs/cifs/file.c
fs/cifs/file.c
+4
-1
fs/cifs/inode.c
fs/cifs/inode.c
+3
-3
fs/cifs/readdir.c
fs/cifs/readdir.c
+3
-3
未找到文件。
fs/cifs/cifsproto.h
浏览文件 @
7ba52631
...
...
@@ -57,7 +57,7 @@ extern int SendReceiveBlockingLock(const unsigned int /* xid */ ,
int
*
/* bytes returned */
);
extern
int
checkSMB
(
struct
smb_hdr
*
smb
,
__u16
mid
,
unsigned
int
length
);
extern
int
is_valid_oplock_break
(
struct
smb_hdr
*
smb
,
struct
TCP_Server_Info
*
);
extern
int
is_size_safe_to_change
(
struct
cifsInodeInfo
*
);
extern
int
is_size_safe_to_change
(
struct
cifsInodeInfo
*
,
__u64
eof
);
extern
struct
cifsFileInfo
*
find_writable_file
(
struct
cifsInodeInfo
*
);
extern
unsigned
int
smbCalcSize
(
struct
smb_hdr
*
ptr
);
extern
unsigned
int
smbCalcSize_LE
(
struct
smb_hdr
*
ptr
);
...
...
fs/cifs/file.c
浏览文件 @
7ba52631
...
...
@@ -1954,7 +1954,7 @@ static int cifs_readpage(struct file *file, struct page *page)
refreshing the inode only on increases in the file size
but this is tricky to do without racing with writebehind
page caching in the current Linux kernel design */
int
is_size_safe_to_change
(
struct
cifsInodeInfo
*
cifsInode
)
int
is_size_safe_to_change
(
struct
cifsInodeInfo
*
cifsInode
,
__u64
end_of_file
)
{
struct
cifsFileInfo
*
open_file
=
NULL
;
...
...
@@ -1976,6 +1976,9 @@ int is_size_safe_to_change(struct cifsInodeInfo *cifsInode)
return
1
;
}
if
(
i_size_read
(
&
cifsInode
->
vfs_inode
)
<
end_of_file
)
return
1
;
return
0
;
}
else
return
1
;
...
...
fs/cifs/inode.c
浏览文件 @
7ba52631
...
...
@@ -140,7 +140,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
inode
->
i_gid
=
le64_to_cpu
(
findData
.
Gid
);
inode
->
i_nlink
=
le64_to_cpu
(
findData
.
Nlinks
);
if
(
is_size_safe_to_change
(
cifsInfo
))
{
if
(
is_size_safe_to_change
(
cifsInfo
,
end_of_file
))
{
/* can not safely change the file size here if the
client is writing to it due to potential races */
...
...
@@ -491,8 +491,8 @@ int cifs_get_inode_info(struct inode **pinode,
/* BB add code here -
validate if device or weird share or device type? */
}
if
(
is_size_safe_to_change
(
cifsInfo
))
{
/* can not safely
change
the file size here if the
if
(
is_size_safe_to_change
(
cifsInfo
,
le64_to_cpu
(
pfindData
->
EndOfFile
)
))
{
/* can not safely
shrink
the file size here if the
client is writing to it due to potential races */
i_size_write
(
inode
,
le64_to_cpu
(
pfindData
->
EndOfFile
));
...
...
fs/cifs/readdir.c
浏览文件 @
7ba52631
...
...
@@ -222,7 +222,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
atomic_set
(
&
cifsInfo
->
inUse
,
1
);
}
if
(
is_size_safe_to_change
(
cifsInfo
))
{
if
(
is_size_safe_to_change
(
cifsInfo
,
end_of_file
))
{
/* can not safely change the file size here if the
client is writing to it due to potential races */
i_size_write
(
tmp_inode
,
end_of_file
);
...
...
@@ -351,10 +351,10 @@ static void unix_fill_in_inode(struct inode *tmp_inode,
tmp_inode
->
i_gid
=
le64_to_cpu
(
pfindData
->
Gid
);
tmp_inode
->
i_nlink
=
le64_to_cpu
(
pfindData
->
Nlinks
);
if
(
is_size_safe_to_change
(
cifsInfo
))
{
if
(
is_size_safe_to_change
(
cifsInfo
,
end_of_file
))
{
/* can not safely change the file size here if the
client is writing to it due to potential races */
i_size_write
(
tmp_inode
,
end_of_file
);
i_size_write
(
tmp_inode
,
end_of_file
);
/* 512 bytes (2**9) is the fake blocksize that must be used */
/* for this calculation, not the real blocksize */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录