--- linux-2.6.10/include/linux/sunrpc/cache.h.orig 2005-06-01 15:05:58.000000000 -0600 +++ linux-2.6.10/include/linux/sunrpc/cache.h 2005-06-01 15:12:06.000000000 -0600 @@ -264,13 +264,12 @@ static inline struct cache_head *cache_ static inline int cache_put(struct cache_head *h, struct cache_detail *cd) { - atomic_dec(&h->refcnt); - if (!atomic_read(&h->refcnt) && - h->expiry_time < cd->nextcheck) - cd->nextcheck = h->expiry_time; - if (!test_bit(CACHE_HASHED, &h->flags) && - !atomic_read(&h->refcnt)) - return 1; + if (atomic_dec_and_test(&h->refcnt)) { + if (h->expiry_time < cd->nextcheck) + cd->nextcheck = h->expiry_time; + if (!test_bit(CACHE_HASHED, &h->flags)) + return 1; + } return 0; }