From 74001bcdb263608b699b7be5a8955cd5910045d2 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 17 Jun 2003 06:38:50 -0700 Subject: [PATCH] kNFSd: Assorted fixed for NFS export cache The most significant fix is cleaning up properly when nfs service is stopped. Also fix some refcounting problems and other little bits. --- include/linux/sunrpc/cache.h | 9 +++++++-- include/linux/sunrpc/svc.h | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'include/linux/sunrpc') diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h index 1d3bccefe959..f8ebf0b4303d 100644 --- a/include/linux/sunrpc/cache.h +++ b/include/linux/sunrpc/cache.h @@ -115,6 +115,8 @@ struct cache_deferred_req { struct list_head recent; /* on fifo */ struct cache_head *item; /* cache item we wait on */ time_t recv_time; + void *owner; /* we might need to discard all defered requests + * owned by someone */ void (*revisit)(struct cache_deferred_req *req, int too_many); }; @@ -168,12 +170,14 @@ RTN *FNAME ARGS \ tmp = container_of(*hp, RTN, MEMBER); \ if (TEST) { /* found a match */ \ \ + if (set == 1 && test_bit(CACHE_VALID, &tmp->MEMBER.flags) && !new) \ + break; \ + \ atomic_inc(&tmp->MEMBER.refcnt); \ if (set) { \ - if (set!= 2 && test_bit(CACHE_VALID, &tmp->MEMBER.flags))\ + if (set == 1 && test_bit(CACHE_VALID, &tmp->MEMBER.flags))\ { /* need to swap in new */ \ RTN *t2; \ - if (!new) break; \ \ new->MEMBER.next = tmp->MEMBER.next; \ *hp = &new->MEMBER; \ @@ -242,6 +246,7 @@ RTN *FNAME ARGS \ extern void cache_defer_req(struct cache_req *req, struct cache_head *item); extern void cache_revisit_request(struct cache_head *item); +extern void cache_clean_deferred(void *owner); static inline struct cache_head *cache_get(struct cache_head *h) { diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index eee6a0664d75..d2996007633b 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -218,7 +218,6 @@ static inline void svc_free_allpages(struct svc_rqst *rqstp) } struct svc_deferred_req { - struct svc_serv *serv; u32 prot; /* protocol (UDP or TCP) */ struct sockaddr_in addr; struct svc_sock *svsk; /* where reply must go */ -- cgit v1.2.3