Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
55157dfb
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
55157dfb
编写于
2月 28, 2012
作者:
P
Pavel Shilovsky
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CIFS: Separate protocol specific part from getlk
Signed-off-by:
N
Pavel Shilovsky
<
piastry@etersoft.ru
>
上级
106dc538
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
22 deletion
+39
-22
fs/cifs/cifsglob.h
fs/cifs/cifsglob.h
+2
-0
fs/cifs/file.c
fs/cifs/file.c
+30
-22
fs/cifs/smb1ops.c
fs/cifs/smb1ops.c
+7
-0
未找到文件。
fs/cifs/cifsglob.h
浏览文件 @
55157dfb
...
@@ -156,10 +156,12 @@ enum smb_version {
...
@@ -156,10 +156,12 @@ enum smb_version {
struct
mid_q_entry
;
struct
mid_q_entry
;
struct
TCP_Server_Info
;
struct
TCP_Server_Info
;
struct
cifsFileInfo
;
struct
smb_version_operations
{
struct
smb_version_operations
{
int
(
*
send_cancel
)(
struct
TCP_Server_Info
*
,
void
*
,
int
(
*
send_cancel
)(
struct
TCP_Server_Info
*
,
void
*
,
struct
mid_q_entry
*
);
struct
mid_q_entry
*
);
bool
(
*
compare_fids
)(
struct
cifsFileInfo
*
,
struct
cifsFileInfo
*
);
};
};
struct
smb_version_values
{
struct
smb_version_values
{
...
...
fs/cifs/file.c
浏览文件 @
55157dfb
...
@@ -671,7 +671,7 @@ cifs_del_lock_waiters(struct cifsLockInfo *lock)
...
@@ -671,7 +671,7 @@ cifs_del_lock_waiters(struct cifsLockInfo *lock)
static
bool
static
bool
cifs_find_fid_lock_conflict
(
struct
cifsFileInfo
*
cfile
,
__u64
offset
,
cifs_find_fid_lock_conflict
(
struct
cifsFileInfo
*
cfile
,
__u64
offset
,
__u64
length
,
__u8
type
,
__u16
netfid
,
__u64
length
,
__u8
type
,
struct
cifsFileInfo
*
cur
,
struct
cifsLockInfo
**
conf_lock
)
struct
cifsLockInfo
**
conf_lock
)
{
{
struct
cifsLockInfo
*
li
;
struct
cifsLockInfo
*
li
;
...
@@ -682,8 +682,8 @@ cifs_find_fid_lock_conflict(struct cifsFileInfo *cfile, __u64 offset,
...
@@ -682,8 +682,8 @@ cifs_find_fid_lock_conflict(struct cifsFileInfo *cfile, __u64 offset,
offset
>=
li
->
offset
+
li
->
length
)
offset
>=
li
->
offset
+
li
->
length
)
continue
;
continue
;
else
if
((
type
&
server
->
vals
->
shared_lock_type
)
&&
else
if
((
type
&
server
->
vals
->
shared_lock_type
)
&&
((
netfid
==
cfile
->
netfid
&&
current
->
tgid
==
li
->
pid
)
((
server
->
ops
->
compare_fids
(
cur
,
cfile
)
&&
||
type
==
li
->
type
))
current
->
tgid
==
li
->
pid
)
||
type
==
li
->
type
))
continue
;
continue
;
else
{
else
{
*
conf_lock
=
li
;
*
conf_lock
=
li
;
...
@@ -694,17 +694,17 @@ cifs_find_fid_lock_conflict(struct cifsFileInfo *cfile, __u64 offset,
...
@@ -694,17 +694,17 @@ cifs_find_fid_lock_conflict(struct cifsFileInfo *cfile, __u64 offset,
}
}
static
bool
static
bool
cifs_find_lock_conflict
(
struct
cifsInodeInfo
*
cinode
,
__u64
offset
,
cifs_find_lock_conflict
(
struct
cifsFileInfo
*
cfile
,
__u64
offset
,
__u64
length
,
__u64
length
,
__u8
type
,
__u16
netfid
,
__u8
type
,
struct
cifsLockInfo
**
conf_lock
)
struct
cifsLockInfo
**
conf_lock
)
{
{
bool
rc
=
false
;
bool
rc
=
false
;
struct
cifsFileInfo
*
fid
,
*
tmp
;
struct
cifsFileInfo
*
fid
,
*
tmp
;
struct
cifsInodeInfo
*
cinode
=
CIFS_I
(
cfile
->
dentry
->
d_inode
);
spin_lock
(
&
cifs_file_list_lock
);
spin_lock
(
&
cifs_file_list_lock
);
list_for_each_entry_safe
(
fid
,
tmp
,
&
cinode
->
openFileList
,
flist
)
{
list_for_each_entry_safe
(
fid
,
tmp
,
&
cinode
->
openFileList
,
flist
)
{
rc
=
cifs_find_fid_lock_conflict
(
fid
,
offset
,
length
,
type
,
rc
=
cifs_find_fid_lock_conflict
(
fid
,
offset
,
length
,
type
,
netfid
,
conf_lock
);
cfile
,
conf_lock
);
if
(
rc
)
if
(
rc
)
break
;
break
;
}
}
...
@@ -732,8 +732,8 @@ cifs_lock_test(struct cifsFileInfo *cfile, __u64 offset, __u64 length,
...
@@ -732,8 +732,8 @@ cifs_lock_test(struct cifsFileInfo *cfile, __u64 offset, __u64 length,
mutex_lock
(
&
cinode
->
lock_mutex
);
mutex_lock
(
&
cinode
->
lock_mutex
);
exist
=
cifs_find_lock_conflict
(
c
inod
e
,
offset
,
length
,
type
,
exist
=
cifs_find_lock_conflict
(
c
fil
e
,
offset
,
length
,
type
,
cfile
->
netfid
,
&
conf_lock
);
&
conf_lock
);
if
(
exist
)
{
if
(
exist
)
{
flock
->
fl_start
=
conf_lock
->
offset
;
flock
->
fl_start
=
conf_lock
->
offset
;
flock
->
fl_end
=
conf_lock
->
offset
+
conf_lock
->
length
-
1
;
flock
->
fl_end
=
conf_lock
->
offset
+
conf_lock
->
length
-
1
;
...
@@ -779,8 +779,8 @@ cifs_lock_add_if(struct cifsFileInfo *cfile, struct cifsLockInfo *lock,
...
@@ -779,8 +779,8 @@ cifs_lock_add_if(struct cifsFileInfo *cfile, struct cifsLockInfo *lock,
exist
=
false
;
exist
=
false
;
mutex_lock
(
&
cinode
->
lock_mutex
);
mutex_lock
(
&
cinode
->
lock_mutex
);
exist
=
cifs_find_lock_conflict
(
c
inod
e
,
lock
->
offset
,
lock
->
length
,
exist
=
cifs_find_lock_conflict
(
c
fil
e
,
lock
->
offset
,
lock
->
length
,
lock
->
type
,
cfile
->
netfid
,
&
conf_lock
);
lock
->
type
,
&
conf_lock
);
if
(
!
exist
&&
cinode
->
can_cache_brlcks
)
{
if
(
!
exist
&&
cinode
->
can_cache_brlcks
)
{
list_add_tail
(
&
lock
->
llist
,
&
cfile
->
llist
);
list_add_tail
(
&
lock
->
llist
,
&
cfile
->
llist
);
mutex_unlock
(
&
cinode
->
lock_mutex
);
mutex_unlock
(
&
cinode
->
lock_mutex
);
...
@@ -1116,6 +1116,15 @@ cifs_read_flock(struct file_lock *flock, __u32 *type, int *lock, int *unlock,
...
@@ -1116,6 +1116,15 @@ cifs_read_flock(struct file_lock *flock, __u32 *type, int *lock, int *unlock,
cFYI
(
1
,
"Unknown type of lock"
);
cFYI
(
1
,
"Unknown type of lock"
);
}
}
static
int
cifs_mandatory_lock
(
int
xid
,
struct
cifsFileInfo
*
cfile
,
__u64
offset
,
__u64
length
,
__u32
type
,
int
lock
,
int
unlock
,
bool
wait
)
{
return
CIFSSMBLock
(
xid
,
tlink_tcon
(
cfile
->
tlink
),
cfile
->
netfid
,
current
->
tgid
,
length
,
offset
,
unlock
,
lock
,
(
__u8
)
type
,
wait
,
0
);
}
static
int
static
int
cifs_getlk
(
struct
file
*
file
,
struct
file_lock
*
flock
,
__u32
type
,
cifs_getlk
(
struct
file
*
file
,
struct
file_lock
*
flock
,
__u32
type
,
bool
wait_flag
,
bool
posix_lck
,
int
xid
)
bool
wait_flag
,
bool
posix_lck
,
int
xid
)
...
@@ -1149,12 +1158,11 @@ cifs_getlk(struct file *file, struct file_lock *flock, __u32 type,
...
@@ -1149,12 +1158,11 @@ cifs_getlk(struct file *file, struct file_lock *flock, __u32 type,
return
rc
;
return
rc
;
/* BB we could chain these into one lock request BB */
/* BB we could chain these into one lock request BB */
rc
=
CIFSSMBLock
(
xid
,
tcon
,
netfid
,
current
->
tgid
,
length
,
rc
=
cifs_mandatory_lock
(
xid
,
cfile
,
flock
->
fl_start
,
length
,
type
,
flock
->
fl_start
,
0
,
1
,
type
,
0
,
0
);
1
,
0
,
false
);
if
(
rc
==
0
)
{
if
(
rc
==
0
)
{
rc
=
CIFSSMBLock
(
xid
,
tcon
,
netfid
,
current
->
tgid
,
rc
=
cifs_mandatory_lock
(
xid
,
cfile
,
flock
->
fl_start
,
length
,
length
,
flock
->
fl_start
,
1
,
0
,
type
,
0
,
1
,
false
);
type
,
0
,
0
);
flock
->
fl_type
=
F_UNLCK
;
flock
->
fl_type
=
F_UNLCK
;
if
(
rc
!=
0
)
if
(
rc
!=
0
)
cERROR
(
1
,
"Error unlocking previously locked "
cERROR
(
1
,
"Error unlocking previously locked "
...
@@ -1167,13 +1175,13 @@ cifs_getlk(struct file *file, struct file_lock *flock, __u32 type,
...
@@ -1167,13 +1175,13 @@ cifs_getlk(struct file *file, struct file_lock *flock, __u32 type,
return
0
;
return
0
;
}
}
rc
=
CIFSSMBLock
(
xid
,
tcon
,
netfid
,
current
->
tgid
,
length
,
rc
=
cifs_mandatory_lock
(
xid
,
cfile
,
flock
->
fl_start
,
length
,
flock
->
fl_start
,
0
,
1
,
type
|
server
->
vals
->
shared_lock_type
,
1
,
0
,
type
|
server
->
vals
->
shared_lock_type
,
0
,
0
);
false
);
if
(
rc
==
0
)
{
if
(
rc
==
0
)
{
rc
=
CIFSSMBLock
(
xid
,
tcon
,
netfid
,
current
->
tgid
,
rc
=
cifs_mandatory_lock
(
xid
,
cfile
,
flock
->
fl_start
,
length
,
length
,
flock
->
fl_start
,
1
,
0
,
type
|
server
->
vals
->
shared_lock_type
,
type
|
server
->
vals
->
shared_lock_type
,
0
,
0
);
0
,
1
,
false
);
flock
->
fl_type
=
F_RDLCK
;
flock
->
fl_type
=
F_RDLCK
;
if
(
rc
!=
0
)
if
(
rc
!=
0
)
cERROR
(
1
,
"Error unlocking previously locked "
cERROR
(
1
,
"Error unlocking previously locked "
...
...
fs/cifs/smb1ops.c
浏览文件 @
55157dfb
...
@@ -60,8 +60,15 @@ send_nt_cancel(struct TCP_Server_Info *server, void *buf,
...
@@ -60,8 +60,15 @@ send_nt_cancel(struct TCP_Server_Info *server, void *buf,
return
rc
;
return
rc
;
}
}
static
bool
cifs_compare_fids
(
struct
cifsFileInfo
*
ob1
,
struct
cifsFileInfo
*
ob2
)
{
return
ob1
->
netfid
==
ob2
->
netfid
;
}
struct
smb_version_operations
smb1_operations
=
{
struct
smb_version_operations
smb1_operations
=
{
.
send_cancel
=
send_nt_cancel
,
.
send_cancel
=
send_nt_cancel
,
.
compare_fids
=
cifs_compare_fids
,
};
};
struct
smb_version_values
smb1_values
=
{
struct
smb_version_values
smb1_values
=
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录