Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
106dc538
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,发现更多精彩内容 >>
提交
106dc538
编写于
2月 28, 2012
作者:
P
Pavel Shilovsky
提交者:
Steve French
5月 16, 2012
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CIFS: Separate protocol specific lock type handling
Signed-off-by:
N
Pavel Shilovsky
<
piastry@etersoft.ru
>
上级
04a6aa8a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
16 deletion
+33
-16
fs/cifs/cifsglob.h
fs/cifs/cifsglob.h
+4
-0
fs/cifs/file.c
fs/cifs/file.c
+24
-16
fs/cifs/smb1ops.c
fs/cifs/smb1ops.c
+5
-0
未找到文件。
fs/cifs/cifsglob.h
浏览文件 @
106dc538
...
...
@@ -164,6 +164,10 @@ struct smb_version_operations {
struct
smb_version_values
{
char
*
version_string
;
__u32
large_lock_type
;
__u32
exclusive_lock_type
;
__u32
shared_lock_type
;
__u32
unlock_lock_type
;
};
struct
smb_vol
{
...
...
fs/cifs/file.c
浏览文件 @
106dc538
...
...
@@ -675,12 +675,13 @@ cifs_find_fid_lock_conflict(struct cifsFileInfo *cfile, __u64 offset,
struct
cifsLockInfo
**
conf_lock
)
{
struct
cifsLockInfo
*
li
;
struct
TCP_Server_Info
*
server
=
tlink_tcon
(
cfile
->
tlink
)
->
ses
->
server
;
list_for_each_entry
(
li
,
&
cfile
->
llist
,
llist
)
{
if
(
offset
+
length
<=
li
->
offset
||
offset
>=
li
->
offset
+
li
->
length
)
continue
;
else
if
((
type
&
LOCKING_ANDX_SHARED_LOCK
)
&&
else
if
((
type
&
server
->
vals
->
shared_lock_type
)
&&
((
netfid
==
cfile
->
netfid
&&
current
->
tgid
==
li
->
pid
)
||
type
==
li
->
type
))
continue
;
...
...
@@ -726,6 +727,7 @@ cifs_lock_test(struct cifsFileInfo *cfile, __u64 offset, __u64 length,
int
rc
=
0
;
struct
cifsLockInfo
*
conf_lock
;
struct
cifsInodeInfo
*
cinode
=
CIFS_I
(
cfile
->
dentry
->
d_inode
);
struct
TCP_Server_Info
*
server
=
tlink_tcon
(
cfile
->
tlink
)
->
ses
->
server
;
bool
exist
;
mutex_lock
(
&
cinode
->
lock_mutex
);
...
...
@@ -736,7 +738,7 @@ cifs_lock_test(struct cifsFileInfo *cfile, __u64 offset, __u64 length,
flock
->
fl_start
=
conf_lock
->
offset
;
flock
->
fl_end
=
conf_lock
->
offset
+
conf_lock
->
length
-
1
;
flock
->
fl_pid
=
conf_lock
->
pid
;
if
(
conf_lock
->
type
&
LOCKING_ANDX_SHARED_LOCK
)
if
(
conf_lock
->
type
&
server
->
vals
->
shared_lock_type
)
flock
->
fl_type
=
F_RDLCK
;
else
flock
->
fl_type
=
F_WRLCK
;
...
...
@@ -1069,7 +1071,7 @@ cifs_push_locks(struct cifsFileInfo *cfile)
static
void
cifs_read_flock
(
struct
file_lock
*
flock
,
__u32
*
type
,
int
*
lock
,
int
*
unlock
,
bool
*
wait_flag
)
bool
*
wait_flag
,
struct
TCP_Server_Info
*
server
)
{
if
(
flock
->
fl_flags
&
FL_POSIX
)
cFYI
(
1
,
"Posix"
);
...
...
@@ -1088,24 +1090,27 @@ cifs_read_flock(struct file_lock *flock, __u32 *type, int *lock, int *unlock,
(
~
(
FL_POSIX
|
FL_FLOCK
|
FL_SLEEP
|
FL_ACCESS
|
FL_LEASE
)))
cFYI
(
1
,
"Unknown lock flags 0x%x"
,
flock
->
fl_flags
);
*
type
=
LOCKING_ANDX_LARGE_FILES
;
*
type
=
server
->
vals
->
large_lock_type
;
if
(
flock
->
fl_type
==
F_WRLCK
)
{
cFYI
(
1
,
"F_WRLCK "
);
*
type
|=
server
->
vals
->
exclusive_lock_type
;
*
lock
=
1
;
}
else
if
(
flock
->
fl_type
==
F_UNLCK
)
{
cFYI
(
1
,
"F_UNLCK"
);
*
type
|=
server
->
vals
->
unlock_lock_type
;
*
unlock
=
1
;
/* Check if unlock includes more than one lock range */
}
else
if
(
flock
->
fl_type
==
F_RDLCK
)
{
cFYI
(
1
,
"F_RDLCK"
);
*
type
|=
LOCKING_ANDX_SHARED_LOCK
;
*
type
|=
server
->
vals
->
shared_lock_type
;
*
lock
=
1
;
}
else
if
(
flock
->
fl_type
==
F_EXLCK
)
{
cFYI
(
1
,
"F_EXLCK"
);
*
type
|=
server
->
vals
->
exclusive_lock_type
;
*
lock
=
1
;
}
else
if
(
flock
->
fl_type
==
F_SHLCK
)
{
cFYI
(
1
,
"F_SHLCK"
);
*
type
|=
LOCKING_ANDX_SHARED_LOCK
;
*
type
|=
server
->
vals
->
shared_lock_type
;
*
lock
=
1
;
}
else
cFYI
(
1
,
"Unknown type of lock"
);
...
...
@@ -1119,6 +1124,7 @@ cifs_getlk(struct file *file, struct file_lock *flock, __u32 type,
__u64
length
=
1
+
flock
->
fl_end
-
flock
->
fl_start
;
struct
cifsFileInfo
*
cfile
=
(
struct
cifsFileInfo
*
)
file
->
private_data
;
struct
cifs_tcon
*
tcon
=
tlink_tcon
(
cfile
->
tlink
);
struct
TCP_Server_Info
*
server
=
tcon
->
ses
->
server
;
__u16
netfid
=
cfile
->
netfid
;
if
(
posix_lck
)
{
...
...
@@ -1128,7 +1134,7 @@ cifs_getlk(struct file *file, struct file_lock *flock, __u32 type,
if
(
!
rc
)
return
rc
;
if
(
type
&
LOCKING_ANDX_SHARED_LOCK
)
if
(
type
&
server
->
vals
->
shared_lock_type
)
posix_lock_type
=
CIFS_RDLCK
;
else
posix_lock_type
=
CIFS_WRLCK
;
...
...
@@ -1152,23 +1158,22 @@ cifs_getlk(struct file *file, struct file_lock *flock, __u32 type,
flock
->
fl_type
=
F_UNLCK
;
if
(
rc
!=
0
)
cERROR
(
1
,
"Error unlocking previously locked "
"range %d during test of lock"
,
rc
);
"range %d during test of lock"
,
rc
);
return
0
;
}
if
(
type
&
LOCKING_ANDX_SHARED_LOCK
)
{
if
(
type
&
server
->
vals
->
shared_lock_type
)
{
flock
->
fl_type
=
F_WRLCK
;
return
0
;
}
rc
=
CIFSSMBLock
(
xid
,
tcon
,
netfid
,
current
->
tgid
,
length
,
flock
->
fl_start
,
0
,
1
,
type
|
LOCKING_ANDX_SHARED_LOCK
,
0
,
0
);
type
|
server
->
vals
->
shared_lock_type
,
0
,
0
);
if
(
rc
==
0
)
{
rc
=
CIFSSMBLock
(
xid
,
tcon
,
netfid
,
current
->
tgid
,
length
,
flock
->
fl_start
,
1
,
0
,
type
|
LOCKING_ANDX_SHARED_LOCK
,
0
,
0
);
type
|
server
->
vals
->
shared_lock_type
,
0
,
0
);
flock
->
fl_type
=
F_RDLCK
;
if
(
rc
!=
0
)
cERROR
(
1
,
"Error unlocking previously locked "
...
...
@@ -1307,6 +1312,7 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,
__u64
length
=
1
+
flock
->
fl_end
-
flock
->
fl_start
;
struct
cifsFileInfo
*
cfile
=
(
struct
cifsFileInfo
*
)
file
->
private_data
;
struct
cifs_tcon
*
tcon
=
tlink_tcon
(
cfile
->
tlink
);
struct
TCP_Server_Info
*
server
=
tcon
->
ses
->
server
;
__u16
netfid
=
cfile
->
netfid
;
if
(
posix_lck
)
{
...
...
@@ -1316,7 +1322,7 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,
if
(
!
rc
||
rc
<
0
)
return
rc
;
if
(
type
&
LOCKING_ANDX_SHARED_LOCK
)
if
(
type
&
server
->
vals
->
shared_lock_type
)
posix_lock_type
=
CIFS_RDLCK
;
else
posix_lock_type
=
CIFS_WRLCK
;
...
...
@@ -1380,11 +1386,13 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *flock)
"end: %lld"
,
cmd
,
flock
->
fl_flags
,
flock
->
fl_type
,
flock
->
fl_start
,
flock
->
fl_end
);
cifs_read_flock
(
flock
,
&
type
,
&
lock
,
&
unlock
,
&
wait_flag
);
cifs_sb
=
CIFS_SB
(
file
->
f_path
.
dentry
->
d_sb
);
cfile
=
(
struct
cifsFileInfo
*
)
file
->
private_data
;
tcon
=
tlink_tcon
(
cfile
->
tlink
);
cifs_read_flock
(
flock
,
&
type
,
&
lock
,
&
unlock
,
&
wait_flag
,
tcon
->
ses
->
server
);
cifs_sb
=
CIFS_SB
(
file
->
f_path
.
dentry
->
d_sb
);
netfid
=
cfile
->
netfid
;
cinode
=
CIFS_I
(
file
->
f_path
.
dentry
->
d_inode
);
...
...
fs/cifs/smb1ops.c
浏览文件 @
106dc538
...
...
@@ -20,6 +20,7 @@
#include "cifsglob.h"
#include "cifsproto.h"
#include "cifs_debug.h"
#include "cifspdu.h"
/*
* An NT cancel request header looks just like the original request except:
...
...
@@ -65,4 +66,8 @@ struct smb_version_operations smb1_operations = {
struct
smb_version_values
smb1_values
=
{
.
version_string
=
SMB1_VERSION_STRING
,
.
large_lock_type
=
LOCKING_ANDX_LARGE_FILES
,
.
exclusive_lock_type
=
0
,
.
shared_lock_type
=
LOCKING_ANDX_SHARED_LOCK
,
.
unlock_lock_type
=
0
,
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录