@@ -76,6 +76,7 @@ struct rsi {
76
76
struct xdr_netobj in_handle , in_token ;
77
77
struct xdr_netobj out_handle , out_token ;
78
78
int major_status , minor_status ;
79
+ struct rcu_head rcu_head ;
79
80
};
80
81
81
82
static struct rsi * rsi_update (struct cache_detail * cd , struct rsi * new , struct rsi * old );
@@ -89,13 +90,21 @@ static void rsi_free(struct rsi *rsii)
89
90
kfree (rsii -> out_token .data );
90
91
}
91
92
92
- static void rsi_put (struct kref * ref )
93
+ static void rsi_free_rcu (struct rcu_head * head )
93
94
{
94
- struct rsi * rsii = container_of (ref , struct rsi , h .ref );
95
+ struct rsi * rsii = container_of (head , struct rsi , rcu_head );
96
+
95
97
rsi_free (rsii );
96
98
kfree (rsii );
97
99
}
98
100
101
+ static void rsi_put (struct kref * ref )
102
+ {
103
+ struct rsi * rsii = container_of (ref , struct rsi , h .ref );
104
+
105
+ call_rcu (& rsii -> rcu_head , rsi_free_rcu );
106
+ }
107
+
99
108
static inline int rsi_hash (struct rsi * item )
100
109
{
101
110
return hash_mem (item -> in_handle .data , item -> in_handle .len , RSI_HASHBITS )
@@ -282,7 +291,7 @@ static struct rsi *rsi_lookup(struct cache_detail *cd, struct rsi *item)
282
291
struct cache_head * ch ;
283
292
int hash = rsi_hash (item );
284
293
285
- ch = sunrpc_cache_lookup (cd , & item -> h , hash );
294
+ ch = sunrpc_cache_lookup_rcu (cd , & item -> h , hash );
286
295
if (ch )
287
296
return container_of (ch , struct rsi , h );
288
297
else
@@ -330,6 +339,7 @@ struct rsc {
330
339
struct svc_cred cred ;
331
340
struct gss_svc_seq_data seqdata ;
332
341
struct gss_ctx * mechctx ;
342
+ struct rcu_head rcu_head ;
333
343
};
334
344
335
345
static struct rsc * rsc_update (struct cache_detail * cd , struct rsc * new , struct rsc * old );
@@ -343,12 +353,22 @@ static void rsc_free(struct rsc *rsci)
343
353
free_svc_cred (& rsci -> cred );
344
354
}
345
355
356
+ static void rsc_free_rcu (struct rcu_head * head )
357
+ {
358
+ struct rsc * rsci = container_of (head , struct rsc , rcu_head );
359
+
360
+ kfree (rsci -> handle .data );
361
+ kfree (rsci );
362
+ }
363
+
346
364
static void rsc_put (struct kref * ref )
347
365
{
348
366
struct rsc * rsci = container_of (ref , struct rsc , h .ref );
349
367
350
- rsc_free (rsci );
351
- kfree (rsci );
368
+ if (rsci -> mechctx )
369
+ gss_delete_sec_context (& rsci -> mechctx );
370
+ free_svc_cred (& rsci -> cred );
371
+ call_rcu (& rsci -> rcu_head , rsc_free_rcu );
352
372
}
353
373
354
374
static inline int
@@ -542,7 +562,7 @@ static struct rsc *rsc_lookup(struct cache_detail *cd, struct rsc *item)
542
562
struct cache_head * ch ;
543
563
int hash = rsc_hash (item );
544
564
545
- ch = sunrpc_cache_lookup (cd , & item -> h , hash );
565
+ ch = sunrpc_cache_lookup_rcu (cd , & item -> h , hash );
546
566
if (ch )
547
567
return container_of (ch , struct rsc , h );
548
568
else
0 commit comments