Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
79b18181
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
79b18181
编写于
10月 14, 2018
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SUNRPC: Convert auth creds to use refcount_t
Signed-off-by:
N
Trond Myklebust
<
trond.myklebust@hammerspace.com
>
上级
07d02a67
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
10 deletion
+10
-10
include/linux/sunrpc/auth.h
include/linux/sunrpc/auth.h
+2
-2
net/sunrpc/auth.c
net/sunrpc/auth.c
+7
-7
net/sunrpc/auth_null.c
net/sunrpc/auth_null.c
+1
-1
未找到文件。
include/linux/sunrpc/auth.h
浏览文件 @
79b18181
...
...
@@ -67,7 +67,7 @@ struct rpc_cred {
const
struct
rpc_credops
*
cr_ops
;
unsigned
long
cr_expire
;
/* when to gc */
unsigned
long
cr_flags
;
/* various flags */
atomic
_t
cr_count
;
/* ref count */
refcount
_t
cr_count
;
/* ref count */
kuid_t
cr_uid
;
...
...
@@ -208,7 +208,7 @@ char * rpcauth_stringify_acceptor(struct rpc_cred *);
static
inline
struct
rpc_cred
*
get_rpccred
(
struct
rpc_cred
*
cred
)
{
if
(
cred
!=
NULL
&&
atomic
_inc_not_zero
(
&
cred
->
cr_count
))
if
(
cred
!=
NULL
&&
refcount
_inc_not_zero
(
&
cred
->
cr_count
))
return
cred
;
return
NULL
;
}
...
...
net/sunrpc/auth.c
浏览文件 @
79b18181
...
...
@@ -495,7 +495,7 @@ rpcauth_prune_expired(struct list_head *free, int nr_to_scan)
if
(
nr_to_scan
--
==
0
)
break
;
if
(
atomic
_read
(
&
cred
->
cr_count
)
>
1
)
{
if
(
refcount
_read
(
&
cred
->
cr_count
)
>
1
)
{
rpcauth_lru_remove_locked
(
cred
);
continue
;
}
...
...
@@ -589,7 +589,7 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
continue
;
if
(
flags
&
RPCAUTH_LOOKUP_RCU
)
{
if
(
test_bit
(
RPCAUTH_CRED_NEW
,
&
entry
->
cr_flags
)
||
atomic
_read
(
&
entry
->
cr_count
)
==
0
)
refcount
_read
(
&
entry
->
cr_count
)
==
0
)
continue
;
cred
=
entry
;
break
;
...
...
@@ -623,7 +623,7 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
if
(
cred
==
NULL
)
{
cred
=
new
;
set_bit
(
RPCAUTH_CRED_HASHED
,
&
cred
->
cr_flags
);
atomic
_inc
(
&
cred
->
cr_count
);
refcount
_inc
(
&
cred
->
cr_count
);
hlist_add_head_rcu
(
&
cred
->
cr_hash
,
&
cache
->
hashtable
[
nr
]);
}
else
list_add_tail
(
&
new
->
cr_lru
,
&
free
);
...
...
@@ -670,7 +670,7 @@ rpcauth_init_cred(struct rpc_cred *cred, const struct auth_cred *acred,
{
INIT_HLIST_NODE
(
&
cred
->
cr_hash
);
INIT_LIST_HEAD
(
&
cred
->
cr_lru
);
atomic
_set
(
&
cred
->
cr_count
,
1
);
refcount
_set
(
&
cred
->
cr_count
,
1
);
cred
->
cr_auth
=
auth
;
cred
->
cr_ops
=
ops
;
cred
->
cr_expire
=
jiffies
;
...
...
@@ -739,9 +739,9 @@ put_rpccred(struct rpc_cred *cred)
if
(
cred
==
NULL
)
return
;
rcu_read_lock
();
if
(
atomic
_dec_and_test
(
&
cred
->
cr_count
))
if
(
refcount
_dec_and_test
(
&
cred
->
cr_count
))
goto
destroy
;
if
(
atomic
_read
(
&
cred
->
cr_count
)
!=
1
||
if
(
refcount
_read
(
&
cred
->
cr_count
)
!=
1
||
!
test_bit
(
RPCAUTH_CRED_HASHED
,
&
cred
->
cr_flags
))
goto
out
;
if
(
test_bit
(
RPCAUTH_CRED_UPTODATE
,
&
cred
->
cr_flags
)
!=
0
)
{
...
...
@@ -752,7 +752,7 @@ put_rpccred(struct rpc_cred *cred)
rpcauth_lru_remove
(
cred
);
}
else
if
(
rpcauth_unhash_cred
(
cred
))
{
rpcauth_lru_remove
(
cred
);
if
(
atomic
_dec_and_test
(
&
cred
->
cr_count
))
if
(
refcount
_dec_and_test
(
&
cred
->
cr_count
))
goto
destroy
;
}
out:
...
...
net/sunrpc/auth_null.c
浏览文件 @
79b18181
...
...
@@ -138,6 +138,6 @@ struct rpc_cred null_cred = {
.
cr_lru
=
LIST_HEAD_INIT
(
null_cred
.
cr_lru
),
.
cr_auth
=
&
null_auth
,
.
cr_ops
=
&
null_credops
,
.
cr_count
=
ATOMIC
_INIT
(
2
),
.
cr_count
=
REFCOUNT
_INIT
(
2
),
.
cr_flags
=
1UL
<<
RPCAUTH_CRED_UPTODATE
,
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录