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
9d956f5b
Commit
9d956f5b
authored
Mar 10, 2005
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RPC: Move credcache-specific code out of put_rpccred()
Signed-off-by:
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
parent
cf6dd6f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
35 deletions
+11
-35
net/sunrpc/auth.c
net/sunrpc/auth.c
+8
-32
net/sunrpc/auth_gss/auth_gss.c
net/sunrpc/auth_gss/auth_gss.c
+1
-1
net/sunrpc/auth_null.c
net/sunrpc/auth_null.c
+1
-1
net/sunrpc/auth_unix.c
net/sunrpc/auth_unix.c
+1
-1
No files found.
net/sunrpc/auth.c
View file @
9d956f5b
...
@@ -98,21 +98,6 @@ rpcauth_init_credcache(struct rpc_auth *auth)
...
@@ -98,21 +98,6 @@ rpcauth_init_credcache(struct rpc_auth *auth)
auth
->
au_nextgc
=
jiffies
+
(
auth
->
au_expire
>>
1
);
auth
->
au_nextgc
=
jiffies
+
(
auth
->
au_expire
>>
1
);
}
}
/*
* Destroy an unreferenced credential
*/
static
inline
void
rpcauth_crdestroy
(
struct
rpc_cred
*
cred
)
{
#ifdef RPC_DEBUG
BUG_ON
(
cred
->
cr_magic
!=
RPCAUTH_CRED_MAGIC
||
atomic_read
(
&
cred
->
cr_count
)
||
!
list_empty
(
&
cred
->
cr_hash
));
cred
->
cr_magic
=
0
;
#endif
cred
->
cr_ops
->
crdestroy
(
cred
);
}
/*
/*
* Destroy a list of credentials
* Destroy a list of credentials
*/
*/
...
@@ -124,7 +109,7 @@ void rpcauth_destroy_credlist(struct list_head *head)
...
@@ -124,7 +109,7 @@ void rpcauth_destroy_credlist(struct list_head *head)
while
(
!
list_empty
(
head
))
{
while
(
!
list_empty
(
head
))
{
cred
=
list_entry
(
head
->
next
,
struct
rpc_cred
,
cr_hash
);
cred
=
list_entry
(
head
->
next
,
struct
rpc_cred
,
cr_hash
);
list_del_init
(
&
cred
->
cr_hash
);
list_del_init
(
&
cred
->
cr_hash
);
rpcauth_crdestroy
(
cred
);
put_rpccred
(
cred
);
}
}
}
}
...
@@ -145,9 +130,7 @@ rpcauth_free_credcache(struct rpc_auth *auth)
...
@@ -145,9 +130,7 @@ rpcauth_free_credcache(struct rpc_auth *auth)
list_for_each_safe
(
pos
,
next
,
&
auth
->
au_credcache
[
i
])
{
list_for_each_safe
(
pos
,
next
,
&
auth
->
au_credcache
[
i
])
{
cred
=
list_entry
(
pos
,
struct
rpc_cred
,
cr_hash
);
cred
=
list_entry
(
pos
,
struct
rpc_cred
,
cr_hash
);
cred
->
cr_auth
=
NULL
;
cred
->
cr_auth
=
NULL
;
list_del_init
(
&
cred
->
cr_hash
);
list_move
(
&
cred
->
cr_hash
,
&
free
);
if
(
atomic_read
(
&
cred
->
cr_count
)
==
0
)
list_add
(
&
cred
->
cr_hash
,
&
free
);
}
}
}
}
spin_unlock
(
&
rpc_credcache_lock
);
spin_unlock
(
&
rpc_credcache_lock
);
...
@@ -157,13 +140,12 @@ rpcauth_free_credcache(struct rpc_auth *auth)
...
@@ -157,13 +140,12 @@ rpcauth_free_credcache(struct rpc_auth *auth)
static
inline
int
static
inline
int
rpcauth_prune_expired
(
struct
rpc_cred
*
cred
,
struct
list_head
*
free
)
rpcauth_prune_expired
(
struct
rpc_cred
*
cred
,
struct
list_head
*
free
)
{
{
if
(
atomic_read
(
&
cred
->
cr_count
)
!=
0
)
if
(
atomic_read
(
&
cred
->
cr_count
)
!=
1
)
return
0
;
return
0
;
if
(
time_before
(
jiffies
,
cred
->
cr_expire
))
if
(
time_before
(
jiffies
,
cred
->
cr_expire
+
cred
->
cr_auth
->
au_expire
))
return
0
;
return
0
;
cred
->
cr_auth
=
NULL
;
cred
->
cr_auth
=
NULL
;
list_del
(
&
cred
->
cr_hash
);
list_move
(
&
cred
->
cr_hash
,
free
);
list_add
(
&
cred
->
cr_hash
,
free
);
return
1
;
return
1
;
}
}
...
@@ -297,16 +279,10 @@ rpcauth_holdcred(struct rpc_task *task)
...
@@ -297,16 +279,10 @@ rpcauth_holdcred(struct rpc_task *task)
void
void
put_rpccred
(
struct
rpc_cred
*
cred
)
put_rpccred
(
struct
rpc_cred
*
cred
)
{
{
if
(
!
atomic_dec_and_lock
(
&
cred
->
cr_count
,
&
rpc_credcache_lock
))
cred
->
cr_expire
=
jiffies
;
return
;
if
(
!
atomic_dec_and_test
(
&
cred
->
cr_count
))
if
(
list_empty
(
&
cred
->
cr_hash
))
{
spin_unlock
(
&
rpc_credcache_lock
);
rpcauth_crdestroy
(
cred
);
return
;
return
;
}
cred
->
cr_ops
->
crdestroy
(
cred
);
cred
->
cr_expire
=
jiffies
+
cred
->
cr_auth
->
au_expire
;
spin_unlock
(
&
rpc_credcache_lock
);
}
}
void
void
...
...
net/sunrpc/auth_gss/auth_gss.c
View file @
9d956f5b
...
@@ -666,7 +666,7 @@ gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int taskflags)
...
@@ -666,7 +666,7 @@ gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int taskflags)
goto
out_err
;
goto
out_err
;
memset
(
cred
,
0
,
sizeof
(
*
cred
));
memset
(
cred
,
0
,
sizeof
(
*
cred
));
atomic_set
(
&
cred
->
gc_count
,
0
);
atomic_set
(
&
cred
->
gc_count
,
1
);
cred
->
gc_uid
=
acred
->
uid
;
cred
->
gc_uid
=
acred
->
uid
;
/*
/*
* Note: in order to force a call to call_refresh(), we deliberately
* Note: in order to force a call to call_refresh(), we deliberately
...
...
net/sunrpc/auth_null.c
View file @
9d956f5b
...
@@ -56,7 +56,7 @@ nul_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
...
@@ -56,7 +56,7 @@ nul_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
if
(
!
(
cred
=
(
struct
rpc_cred
*
)
kmalloc
(
sizeof
(
*
cred
),
GFP_KERNEL
)))
if
(
!
(
cred
=
(
struct
rpc_cred
*
)
kmalloc
(
sizeof
(
*
cred
),
GFP_KERNEL
)))
return
NULL
;
return
NULL
;
atomic_set
(
&
cred
->
cr_count
,
0
);
atomic_set
(
&
cred
->
cr_count
,
1
);
cred
->
cr_flags
=
RPCAUTH_CRED_UPTODATE
;
cred
->
cr_flags
=
RPCAUTH_CRED_UPTODATE
;
cred
->
cr_uid
=
acred
->
uid
;
cred
->
cr_uid
=
acred
->
uid
;
cred
->
cr_ops
=
&
null_credops
;
cred
->
cr_ops
=
&
null_credops
;
...
...
net/sunrpc/auth_unix.c
View file @
9d956f5b
...
@@ -77,7 +77,7 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
...
@@ -77,7 +77,7 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
if
(
!
(
cred
=
(
struct
unx_cred
*
)
kmalloc
(
sizeof
(
*
cred
),
GFP_KERNEL
)))
if
(
!
(
cred
=
(
struct
unx_cred
*
)
kmalloc
(
sizeof
(
*
cred
),
GFP_KERNEL
)))
return
NULL
;
return
NULL
;
atomic_set
(
&
cred
->
uc_count
,
0
);
atomic_set
(
&
cred
->
uc_count
,
1
);
cred
->
uc_flags
=
RPCAUTH_CRED_UPTODATE
;
cred
->
uc_flags
=
RPCAUTH_CRED_UPTODATE
;
if
(
flags
&
RPC_TASK_ROOTCREDS
)
{
if
(
flags
&
RPC_TASK_ROOTCREDS
)
{
cred
->
uc_uid
=
cred
->
uc_puid
=
0
;
cred
->
uc_uid
=
cred
->
uc_puid
=
0
;
...
...
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