Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
5e1abf8c
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,发现更多精彩内容 >>
提交
5e1abf8c
编写于
3月 20, 2006
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lockd: Clean up of the server-side GRANTED code
Signed-off-by:
N
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
上级
6849c0ca
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
53 addition
and
48 deletion
+53
-48
fs/lockd/clntproc.c
fs/lockd/clntproc.c
+0
-43
fs/lockd/svclock.c
fs/lockd/svclock.c
+53
-3
include/linux/lockd/lockd.h
include/linux/lockd/lockd.h
+0
-2
未找到文件。
fs/lockd/clntproc.c
浏览文件 @
5e1abf8c
...
...
@@ -147,49 +147,6 @@ static void nlmclnt_release_lockargs(struct nlm_rqst *req)
fl
->
fl_ops
->
fl_release_private
(
fl
);
}
/*
* Initialize arguments for GRANTED call. The nlm_rqst structure
* has been cleared already.
*/
int
nlmclnt_setgrantargs
(
struct
nlm_rqst
*
call
,
struct
nlm_lock
*
lock
)
{
locks_copy_lock
(
&
call
->
a_args
.
lock
.
fl
,
&
lock
->
fl
);
memcpy
(
&
call
->
a_args
.
lock
.
fh
,
&
lock
->
fh
,
sizeof
(
call
->
a_args
.
lock
.
fh
));
call
->
a_args
.
lock
.
caller
=
system_utsname
.
nodename
;
call
->
a_args
.
lock
.
oh
.
len
=
lock
->
oh
.
len
;
/* set default data area */
call
->
a_args
.
lock
.
oh
.
data
=
call
->
a_owner
;
call
->
a_args
.
lock
.
svid
=
lock
->
fl
.
fl_pid
;
if
(
lock
->
oh
.
len
>
NLMCLNT_OHSIZE
)
{
void
*
data
=
kmalloc
(
lock
->
oh
.
len
,
GFP_KERNEL
);
if
(
!
data
)
{
nlmclnt_freegrantargs
(
call
);
return
0
;
}
call
->
a_args
.
lock
.
oh
.
data
=
(
u8
*
)
data
;
}
memcpy
(
call
->
a_args
.
lock
.
oh
.
data
,
lock
->
oh
.
data
,
lock
->
oh
.
len
);
return
1
;
}
void
nlmclnt_freegrantargs
(
struct
nlm_rqst
*
call
)
{
struct
file_lock
*
fl
=
&
call
->
a_args
.
lock
.
fl
;
/*
* Check whether we allocated memory for the owner.
*/
if
(
call
->
a_args
.
lock
.
oh
.
data
!=
(
u8
*
)
call
->
a_owner
)
{
kfree
(
call
->
a_args
.
lock
.
oh
.
data
);
}
if
(
fl
->
fl_ops
&&
fl
->
fl_ops
->
fl_release_private
)
fl
->
fl_ops
->
fl_release_private
(
fl
);
}
/*
* This is the main entry point for the NLM client.
*/
...
...
fs/lockd/svclock.c
浏览文件 @
5e1abf8c
...
...
@@ -43,6 +43,8 @@ static void nlmsvc_release_block(struct nlm_block *block);
static
void
nlmsvc_insert_block
(
struct
nlm_block
*
block
,
unsigned
long
);
static
int
nlmsvc_remove_block
(
struct
nlm_block
*
block
);
static
int
nlmsvc_setgrantargs
(
struct
nlm_rqst
*
call
,
struct
nlm_lock
*
lock
);
static
void
nlmsvc_freegrantargs
(
struct
nlm_rqst
*
call
);
static
const
struct
rpc_call_ops
nlmsvc_grant_ops
;
/*
...
...
@@ -196,7 +198,7 @@ nlmsvc_create_block(struct svc_rqst *rqstp, struct nlm_file *file,
locks_init_lock
(
&
block
->
b_call
.
a_res
.
lock
.
fl
);
kref_init
(
&
block
->
b_count
);
if
(
!
nlm
clnt
_setgrantargs
(
&
block
->
b_call
,
lock
))
if
(
!
nlm
svc
_setgrantargs
(
&
block
->
b_call
,
lock
))
goto
failed_free
;
/* Set notifier function for VFS, and init args */
...
...
@@ -264,7 +266,7 @@ static void nlmsvc_free_block(struct kref *kref)
if
(
block
->
b_host
)
nlm_release_host
(
block
->
b_host
);
nlm
clnt
_freegrantargs
(
&
block
->
b_call
);
nlm
svc
_freegrantargs
(
&
block
->
b_call
);
kfree
(
block
);
}
...
...
@@ -298,6 +300,49 @@ nlmsvc_traverse_blocks(struct nlm_host *host, struct nlm_file *file, int action)
return
0
;
}
/*
* Initialize arguments for GRANTED call. The nlm_rqst structure
* has been cleared already.
*/
static
int
nlmsvc_setgrantargs
(
struct
nlm_rqst
*
call
,
struct
nlm_lock
*
lock
)
{
locks_copy_lock
(
&
call
->
a_args
.
lock
.
fl
,
&
lock
->
fl
);
memcpy
(
&
call
->
a_args
.
lock
.
fh
,
&
lock
->
fh
,
sizeof
(
call
->
a_args
.
lock
.
fh
));
call
->
a_args
.
lock
.
caller
=
system_utsname
.
nodename
;
call
->
a_args
.
lock
.
oh
.
len
=
lock
->
oh
.
len
;
/* set default data area */
call
->
a_args
.
lock
.
oh
.
data
=
call
->
a_owner
;
call
->
a_args
.
lock
.
svid
=
lock
->
fl
.
fl_pid
;
if
(
lock
->
oh
.
len
>
NLMCLNT_OHSIZE
)
{
void
*
data
=
kmalloc
(
lock
->
oh
.
len
,
GFP_KERNEL
);
if
(
!
data
)
{
nlmsvc_freegrantargs
(
call
);
return
0
;
}
call
->
a_args
.
lock
.
oh
.
data
=
(
u8
*
)
data
;
}
memcpy
(
call
->
a_args
.
lock
.
oh
.
data
,
lock
->
oh
.
data
,
lock
->
oh
.
len
);
return
1
;
}
static
void
nlmsvc_freegrantargs
(
struct
nlm_rqst
*
call
)
{
struct
file_lock
*
fl
=
&
call
->
a_args
.
lock
.
fl
;
/*
* Check whether we allocated memory for the owner.
*/
if
(
call
->
a_args
.
lock
.
oh
.
data
!=
(
u8
*
)
call
->
a_owner
)
{
kfree
(
call
->
a_args
.
lock
.
oh
.
data
);
}
if
(
fl
->
fl_ops
&&
fl
->
fl_ops
->
fl_release_private
)
fl
->
fl_ops
->
fl_release_private
(
fl
);
if
(
fl
->
fl_lmops
&&
fl
->
fl_lmops
->
fl_release_private
)
fl
->
fl_lmops
->
fl_release_private
(
fl
);
}
/*
* Attempt to establish a lock, and if it can't be granted, block it
* if required.
...
...
@@ -600,11 +645,16 @@ static void nlmsvc_grant_callback(struct rpc_task *task, void *data)
}
nlmsvc_insert_block
(
block
,
timeout
);
svc_wake_up
(
block
->
b_daemon
);
nlmsvc_release_block
(
block
);
}
void
nlmsvc_grant_release
(
void
*
data
)
{
nlmsvc_release_block
(
data
);
}
static
const
struct
rpc_call_ops
nlmsvc_grant_ops
=
{
.
rpc_call_done
=
nlmsvc_grant_callback
,
.
rpc_release
=
nlmsvc_grant_release
,
};
/*
...
...
include/linux/lockd/lockd.h
浏览文件 @
5e1abf8c
...
...
@@ -153,8 +153,6 @@ long nlmclnt_block(struct nlm_rqst *req, long timeout);
u32
nlmclnt_grant
(
const
struct
sockaddr_in
*
addr
,
const
struct
nlm_lock
*
);
void
nlmclnt_recovery
(
struct
nlm_host
*
,
u32
);
int
nlmclnt_reclaim
(
struct
nlm_host
*
,
struct
file_lock
*
);
int
nlmclnt_setgrantargs
(
struct
nlm_rqst
*
,
struct
nlm_lock
*
);
void
nlmclnt_freegrantargs
(
struct
nlm_rqst
*
);
/*
* Host cache
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录