aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth_gss
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-03-27 04:15:09 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-27 11:44:43 -0500
commitbaab935ff3bdac20c558809da0d8e8f761840219 (patch)
treea22c3189505fe8e7ab3820c988ffd771c0b64fa6 /net/sunrpc/auth_gss
parentebd0cb1af3be2729cc1f574681dfba01fcf458d9 (diff)
[PATCH] knfsd: Convert sunrpc_cache to use krefs
.. it makes some of the code nicer. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'net/sunrpc/auth_gss')
-rw-r--r--net/sunrpc/auth_gss/svcauth_gss.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 380152603d1e..4d7eb9e704da 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -89,13 +89,11 @@ static void rsi_free(struct rsi *rsii)
89 kfree(rsii->out_token.data); 89 kfree(rsii->out_token.data);
90} 90}
91 91
92static void rsi_put(struct cache_head *item, struct cache_detail *cd) 92static void rsi_put(struct kref *ref)
93{ 93{
94 struct rsi *rsii = container_of(item, struct rsi, h); 94 struct rsi *rsii = container_of(ref, struct rsi, h.ref);
95 if (cache_put(item, cd)) { 95 rsi_free(rsii);
96 rsi_free(rsii); 96 kfree(rsii);
97 kfree(rsii);
98 }
99} 97}
100 98
101static inline int rsi_hash(struct rsi *item) 99static inline int rsi_hash(struct rsi *item)
@@ -267,7 +265,7 @@ static int rsi_parse(struct cache_detail *cd,
267out: 265out:
268 rsi_free(&rsii); 266 rsi_free(&rsii);
269 if (rsip) 267 if (rsip)
270 rsi_put(&rsip->h, &rsi_cache); 268 cache_put(&rsip->h, &rsi_cache);
271 else 269 else
272 status = -ENOMEM; 270 status = -ENOMEM;
273 return status; 271 return status;
@@ -357,14 +355,12 @@ static void rsc_free(struct rsc *rsci)
357 put_group_info(rsci->cred.cr_group_info); 355 put_group_info(rsci->cred.cr_group_info);
358} 356}
359 357
360static void rsc_put(struct cache_head *item, struct cache_detail *cd) 358static void rsc_put(struct kref *ref)
361{ 359{
362 struct rsc *rsci = container_of(item, struct rsc, h); 360 struct rsc *rsci = container_of(ref, struct rsc, h.ref);
363 361
364 if (cache_put(item, cd)) { 362 rsc_free(rsci);
365 rsc_free(rsci); 363 kfree(rsci);
366 kfree(rsci);
367 }
368} 364}
369 365
370static inline int 366static inline int
@@ -509,7 +505,7 @@ static int rsc_parse(struct cache_detail *cd,
509out: 505out:
510 rsc_free(&rsci); 506 rsc_free(&rsci);
511 if (rscp) 507 if (rscp)
512 rsc_put(&rscp->h, &rsc_cache); 508 cache_put(&rscp->h, &rsc_cache);
513 else 509 else
514 status = -ENOMEM; 510 status = -ENOMEM;
515 return status; 511 return status;
@@ -1076,7 +1072,7 @@ drop:
1076 ret = SVC_DROP; 1072 ret = SVC_DROP;
1077out: 1073out:
1078 if (rsci) 1074 if (rsci)
1079 rsc_put(&rsci->h, &rsc_cache); 1075 cache_put(&rsci->h, &rsc_cache);
1080 return ret; 1076 return ret;
1081} 1077}
1082 1078
@@ -1168,7 +1164,7 @@ out_err:
1168 put_group_info(rqstp->rq_cred.cr_group_info); 1164 put_group_info(rqstp->rq_cred.cr_group_info);
1169 rqstp->rq_cred.cr_group_info = NULL; 1165 rqstp->rq_cred.cr_group_info = NULL;
1170 if (gsd->rsci) 1166 if (gsd->rsci)
1171 rsc_put(&gsd->rsci->h, &rsc_cache); 1167 cache_put(&gsd->rsci->h, &rsc_cache);
1172 gsd->rsci = NULL; 1168 gsd->rsci = NULL;
1173 1169
1174 return stat; 1170 return stat;