Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

SUNRPC: introduce cache_check_rcu to help check in rcu context

This is a prepare patch to add cache_check_rcu, will use it with follow
patch.

Suggested-by: NeilBrown <neilb@suse.de>
Signed-off-by: Yang Erkun <yangerkun@huawei.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

authored by

Yang Erkun and committed by
Chuck Lever
2f55dbe4 cb80ecf7

+28 -15
+2
include/linux/sunrpc/cache.h
··· 222 222 return detail->flush_time >= h->last_refresh; 223 223 } 224 224 225 + extern int cache_check_rcu(struct cache_detail *detail, 226 + struct cache_head *h, struct cache_req *rqstp); 225 227 extern int cache_check(struct cache_detail *detail, 226 228 struct cache_head *h, struct cache_req *rqstp); 227 229 extern void cache_flush(void);
+26 -15
net/sunrpc/cache.c
··· 281 281 return rv; 282 282 } 283 283 284 - /* 285 - * This is the generic cache management routine for all 286 - * the authentication caches. 287 - * It checks the currency of a cache item and will (later) 288 - * initiate an upcall to fill it if needed. 289 - * 290 - * 291 - * Returns 0 if the cache_head can be used, or cache_puts it and returns 292 - * -EAGAIN if upcall is pending and request has been queued 293 - * -ETIMEDOUT if upcall failed or request could not be queue or 294 - * upcall completed but item is still invalid (implying that 295 - * the cache item has been replaced with a newer one). 296 - * -ENOENT if cache entry was negative 297 - */ 298 - int cache_check(struct cache_detail *detail, 284 + int cache_check_rcu(struct cache_detail *detail, 299 285 struct cache_head *h, struct cache_req *rqstp) 300 286 { 301 287 int rv; ··· 322 336 rv = -ETIMEDOUT; 323 337 } 324 338 } 339 + 340 + return rv; 341 + } 342 + EXPORT_SYMBOL_GPL(cache_check_rcu); 343 + 344 + /* 345 + * This is the generic cache management routine for all 346 + * the authentication caches. 347 + * It checks the currency of a cache item and will (later) 348 + * initiate an upcall to fill it if needed. 349 + * 350 + * 351 + * Returns 0 if the cache_head can be used, or cache_puts it and returns 352 + * -EAGAIN if upcall is pending and request has been queued 353 + * -ETIMEDOUT if upcall failed or request could not be queue or 354 + * upcall completed but item is still invalid (implying that 355 + * the cache item has been replaced with a newer one). 356 + * -ENOENT if cache entry was negative 357 + */ 358 + int cache_check(struct cache_detail *detail, 359 + struct cache_head *h, struct cache_req *rqstp) 360 + { 361 + int rv; 362 + 363 + rv = cache_check_rcu(detail, h, rqstp); 325 364 if (rv) 326 365 cache_put(h, detail); 327 366 return rv;