Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
79b18181
Commit
79b18181
authored
Oct 14, 2018
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SUNRPC: Convert auth creds to use refcount_t
Signed-off-by:
Trond Myklebust
<
trond.myklebust@hammerspace.com
>
parent
07d02a67
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+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
No files found.
include/linux/sunrpc/auth.h
View file @
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
View file @
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
View file @
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
,
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment