Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
c6d00e63
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
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看板
提交
c6d00e63
编写于
6月 17, 2007
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
NFSv4: Convert struct nfs4_opendata to use struct kref
Signed-off-by:
N
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
上级
3bec63db
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
23 deletion
+30
-23
fs/nfs/nfs4proc.c
fs/nfs/nfs4proc.c
+30
-23
未找到文件。
fs/nfs/nfs4proc.c
浏览文件 @
c6d00e63
...
@@ -214,7 +214,7 @@ static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo)
...
@@ -214,7 +214,7 @@ static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo)
}
}
struct
nfs4_opendata
{
struct
nfs4_opendata
{
atomic_t
count
;
struct
kref
kref
;
struct
nfs_openargs
o_arg
;
struct
nfs_openargs
o_arg
;
struct
nfs_openres
o_res
;
struct
nfs_openres
o_res
;
struct
nfs_open_confirmargs
c_arg
;
struct
nfs_open_confirmargs
c_arg
;
...
@@ -245,7 +245,6 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct path *path,
...
@@ -245,7 +245,6 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct path *path,
p
->
o_arg
.
seqid
=
nfs_alloc_seqid
(
&
sp
->
so_seqid
);
p
->
o_arg
.
seqid
=
nfs_alloc_seqid
(
&
sp
->
so_seqid
);
if
(
p
->
o_arg
.
seqid
==
NULL
)
if
(
p
->
o_arg
.
seqid
==
NULL
)
goto
err_free
;
goto
err_free
;
atomic_set
(
&
p
->
count
,
1
);
p
->
path
.
mnt
=
mntget
(
path
->
mnt
);
p
->
path
.
mnt
=
mntget
(
path
->
mnt
);
p
->
path
.
dentry
=
dget
(
path
->
dentry
);
p
->
path
.
dentry
=
dget
(
path
->
dentry
);
p
->
dir
=
parent
;
p
->
dir
=
parent
;
...
@@ -275,6 +274,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct path *path,
...
@@ -275,6 +274,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct path *path,
p
->
c_arg
.
fh
=
&
p
->
o_res
.
fh
;
p
->
c_arg
.
fh
=
&
p
->
o_res
.
fh
;
p
->
c_arg
.
stateid
=
&
p
->
o_res
.
stateid
;
p
->
c_arg
.
stateid
=
&
p
->
o_res
.
stateid
;
p
->
c_arg
.
seqid
=
p
->
o_arg
.
seqid
;
p
->
c_arg
.
seqid
=
p
->
o_arg
.
seqid
;
kref_init
(
&
p
->
kref
);
return
p
;
return
p
;
err_free:
err_free:
kfree
(
p
);
kfree
(
p
);
...
@@ -283,16 +283,23 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct path *path,
...
@@ -283,16 +283,23 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct path *path,
return
NULL
;
return
NULL
;
}
}
static
void
nfs4_opendata_free
(
struct
nfs4_opendata
*
p
)
static
void
nfs4_opendata_free
(
struct
kref
*
kref
)
{
{
if
(
p
!=
NULL
&&
atomic_dec_and_test
(
&
p
->
count
))
{
struct
nfs4_opendata
*
p
=
container_of
(
kref
,
nfs_free_seqid
(
p
->
o_arg
.
seqid
);
struct
nfs4_opendata
,
kref
);
nfs4_put_state_owner
(
p
->
owner
);
dput
(
p
->
dir
);
nfs_free_seqid
(
p
->
o_arg
.
seqid
);
dput
(
p
->
path
.
dentry
);
nfs4_put_state_owner
(
p
->
owner
);
mntput
(
p
->
path
.
mnt
);
dput
(
p
->
dir
);
kfree
(
p
);
dput
(
p
->
path
.
dentry
);
}
mntput
(
p
->
path
.
mnt
);
kfree
(
p
);
}
static
void
nfs4_opendata_put
(
struct
nfs4_opendata
*
p
)
{
if
(
p
!=
NULL
)
kref_put
(
&
p
->
kref
,
nfs4_opendata_free
);
}
}
static
int
nfs4_wait_for_completion_rpc_task
(
struct
rpc_task
*
task
)
static
int
nfs4_wait_for_completion_rpc_task
(
struct
rpc_task
*
task
)
...
@@ -476,7 +483,7 @@ static int _nfs4_do_open_reclaim(struct nfs_open_context *ctx, struct nfs4_state
...
@@ -476,7 +483,7 @@ static int _nfs4_do_open_reclaim(struct nfs_open_context *ctx, struct nfs4_state
nfs_copy_fh
(
&
opendata
->
o_res
.
fh
,
opendata
->
o_arg
.
fh
);
nfs_copy_fh
(
&
opendata
->
o_res
.
fh
,
opendata
->
o_arg
.
fh
);
opendata
->
o_arg
.
u
.
delegation_type
=
delegation_type
;
opendata
->
o_arg
.
u
.
delegation_type
=
delegation_type
;
status
=
nfs4_open_recover
(
opendata
,
state
);
status
=
nfs4_open_recover
(
opendata
,
state
);
nfs4_opendata_
free
(
opendata
);
nfs4_opendata_
put
(
opendata
);
return
status
;
return
status
;
}
}
...
@@ -522,7 +529,7 @@ static int _nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs
...
@@ -522,7 +529,7 @@ static int _nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs
memcpy
(
opendata
->
o_arg
.
u
.
delegation
.
data
,
state
->
stateid
.
data
,
memcpy
(
opendata
->
o_arg
.
u
.
delegation
.
data
,
state
->
stateid
.
data
,
sizeof
(
opendata
->
o_arg
.
u
.
delegation
.
data
));
sizeof
(
opendata
->
o_arg
.
u
.
delegation
.
data
));
ret
=
nfs4_open_recover
(
opendata
,
state
);
ret
=
nfs4_open_recover
(
opendata
,
state
);
nfs4_opendata_
free
(
opendata
);
nfs4_opendata_
put
(
opendata
);
return
ret
;
return
ret
;
}
}
...
@@ -593,7 +600,7 @@ static void nfs4_open_confirm_release(void *calldata)
...
@@ -593,7 +600,7 @@ static void nfs4_open_confirm_release(void *calldata)
if
(
state
!=
NULL
)
if
(
state
!=
NULL
)
nfs4_close_state
(
&
data
->
path
,
state
,
data
->
o_arg
.
open_flags
);
nfs4_close_state
(
&
data
->
path
,
state
,
data
->
o_arg
.
open_flags
);
out_free:
out_free:
nfs4_opendata_
free
(
data
);
nfs4_opendata_
put
(
data
);
}
}
static
const
struct
rpc_call_ops
nfs4_open_confirm_ops
=
{
static
const
struct
rpc_call_ops
nfs4_open_confirm_ops
=
{
...
@@ -611,7 +618,7 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data)
...
@@ -611,7 +618,7 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data)
struct
rpc_task
*
task
;
struct
rpc_task
*
task
;
int
status
;
int
status
;
atomic_inc
(
&
data
->
count
);
kref_get
(
&
data
->
kref
);
/*
/*
* If rpc_run_task() ends up calling ->rpc_release(), we
* If rpc_run_task() ends up calling ->rpc_release(), we
* want to ensure that it takes the 'error' code path.
* want to ensure that it takes the 'error' code path.
...
@@ -696,7 +703,7 @@ static void nfs4_open_release(void *calldata)
...
@@ -696,7 +703,7 @@ static void nfs4_open_release(void *calldata)
if
(
state
!=
NULL
)
if
(
state
!=
NULL
)
nfs4_close_state
(
&
data
->
path
,
state
,
data
->
o_arg
.
open_flags
);
nfs4_close_state
(
&
data
->
path
,
state
,
data
->
o_arg
.
open_flags
);
out_free:
out_free:
nfs4_opendata_
free
(
data
);
nfs4_opendata_
put
(
data
);
}
}
static
const
struct
rpc_call_ops
nfs4_open_ops
=
{
static
const
struct
rpc_call_ops
nfs4_open_ops
=
{
...
@@ -717,7 +724,7 @@ static int _nfs4_proc_open(struct nfs4_opendata *data)
...
@@ -717,7 +724,7 @@ static int _nfs4_proc_open(struct nfs4_opendata *data)
struct
rpc_task
*
task
;
struct
rpc_task
*
task
;
int
status
;
int
status
;
atomic_inc
(
&
data
->
count
);
kref_get
(
&
data
->
kref
);
/*
/*
* If rpc_run_task() ends up calling ->rpc_release(), we
* If rpc_run_task() ends up calling ->rpc_release(), we
* want to ensure that it takes the 'error' code path.
* want to ensure that it takes the 'error' code path.
...
@@ -826,7 +833,7 @@ static int _nfs4_open_expired(struct nfs_open_context *ctx, struct nfs4_state *s
...
@@ -826,7 +833,7 @@ static int _nfs4_open_expired(struct nfs_open_context *ctx, struct nfs4_state *s
nfs4_drop_state_owner
(
state
->
owner
);
nfs4_drop_state_owner
(
state
->
owner
);
d_drop
(
ctx
->
path
.
dentry
);
d_drop
(
ctx
->
path
.
dentry
);
}
}
nfs4_opendata_
free
(
opendata
);
nfs4_opendata_
put
(
opendata
);
return
ret
;
return
ret
;
}
}
...
@@ -987,7 +994,7 @@ static int _nfs4_do_open(struct inode *dir, struct path *path, int flags, struct
...
@@ -987,7 +994,7 @@ static int _nfs4_do_open(struct inode *dir, struct path *path, int flags, struct
status
=
_nfs4_proc_open
(
opendata
);
status
=
_nfs4_proc_open
(
opendata
);
if
(
status
!=
0
)
if
(
status
!=
0
)
goto
err_opendata_
free
;
goto
err_opendata_
put
;
if
(
opendata
->
o_arg
.
open_flags
&
O_EXCL
)
if
(
opendata
->
o_arg
.
open_flags
&
O_EXCL
)
nfs4_exclusive_attrset
(
opendata
,
sattr
);
nfs4_exclusive_attrset
(
opendata
,
sattr
);
...
@@ -995,16 +1002,16 @@ static int _nfs4_do_open(struct inode *dir, struct path *path, int flags, struct
...
@@ -995,16 +1002,16 @@ static int _nfs4_do_open(struct inode *dir, struct path *path, int flags, struct
status
=
-
ENOMEM
;
status
=
-
ENOMEM
;
state
=
nfs4_opendata_to_nfs4_state
(
opendata
);
state
=
nfs4_opendata_to_nfs4_state
(
opendata
);
if
(
state
==
NULL
)
if
(
state
==
NULL
)
goto
err_opendata_
free
;
goto
err_opendata_
put
;
if
(
opendata
->
o_res
.
delegation_type
!=
0
)
if
(
opendata
->
o_res
.
delegation_type
!=
0
)
nfs_inode_set_delegation
(
state
->
inode
,
cred
,
&
opendata
->
o_res
);
nfs_inode_set_delegation
(
state
->
inode
,
cred
,
&
opendata
->
o_res
);
nfs4_opendata_
free
(
opendata
);
nfs4_opendata_
put
(
opendata
);
nfs4_put_state_owner
(
sp
);
nfs4_put_state_owner
(
sp
);
up_read
(
&
clp
->
cl_sem
);
up_read
(
&
clp
->
cl_sem
);
*
res
=
state
;
*
res
=
state
;
return
0
;
return
0
;
err_opendata_
free
:
err_opendata_
put
:
nfs4_opendata_
free
(
opendata
);
nfs4_opendata_
put
(
opendata
);
err_release_rwsem:
err_release_rwsem:
up_read
(
&
clp
->
cl_sem
);
up_read
(
&
clp
->
cl_sem
);
err_put_state_owner:
err_put_state_owner:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录