Lines Matching refs:rp
219 struct nfsrvcache *rp;
232 for (rp = NFSRCHASH(nd->nd_retxid)->lh_first; rp != 0;
233 rp = rp->rc_hash.le_next) {
234 if (nd->nd_retxid == rp->rc_xid && nd->nd_procnum == rp->rc_proc &&
235 netaddr_match(AF_INET, &rp->rc_haddr, nd->nd_nam)) {
236 if ((rp->rc_flag & RC_LOCKED) != 0) {
237 rp->rc_flag |= RC_WANTED;
238 msleep(rp, nfsrv_reqcache_mutex, PZERO-1, "nfsrc", NULL);
241 rp->rc_flag |= RC_LOCKED;
243 if (rp->rc_lru.tqe_next) {
244 TAILQ_REMOVE(&nfsrv_reqcache_lruhead, rp, rc_lru);
245 TAILQ_INSERT_TAIL(&nfsrv_reqcache_lruhead, rp, rc_lru);
247 if (rp->rc_state == RC_UNUSED)
249 if (rp->rc_state == RC_INPROG) {
252 } else if (rp->rc_flag & RC_REPSTATUS) {
254 nd->nd_repstat = rp->rc_status;
264 } else if (rp->rc_flag & RC_REPMBUF) {
266 error = mbuf_copym(rp->rc_reply, 0, MBUF_COPYALL, MBUF_WAITOK, mrepp);
275 rp->rc_state = RC_INPROG;
278 rp->rc_flag &= ~RC_LOCKED;
279 if (rp->rc_flag & RC_WANTED) {
280 rp->rc_flag &= ~RC_WANTED;
281 wakeup(rp);
290 MALLOC(rp, struct nfsrvcache *, sizeof *rp, M_NFSD, M_WAITOK);
291 if (rp) {
292 bzero((char *)rp, sizeof *rp);
294 rp->rc_flag = RC_LOCKED;
297 rp = NULL;
299 if (!rp) {
301 rp = nfsrv_reqcache_lruhead.tqh_first;
302 if (!rp) {
308 while ((rp->rc_flag & RC_LOCKED) != 0) {
309 rp->rc_flag |= RC_WANTED;
310 msleep(rp, nfsrv_reqcache_mutex, PZERO-1, "nfsrc", NULL);
311 rp = nfsrv_reqcache_lruhead.tqh_first;
313 rp->rc_flag |= RC_LOCKED;
314 LIST_REMOVE(rp, rc_hash);
315 TAILQ_REMOVE(&nfsrv_reqcache_lruhead, rp, rc_lru);
316 if (rp->rc_flag & RC_REPMBUF)
317 mbuf_freem(rp->rc_reply);
318 if (rp->rc_flag & RC_NAM)
319 mbuf_freem(rp->rc_nam);
320 rp->rc_flag &= (RC_LOCKED | RC_WANTED);
322 TAILQ_INSERT_TAIL(&nfsrv_reqcache_lruhead, rp, rc_lru);
323 rp->rc_state = RC_INPROG;
324 rp->rc_xid = nd->nd_retxid;
328 rp->rc_flag |= RC_INETADDR;
329 rp->rc_inetaddr = saddr->sin_addr.s_addr;
332 error = mbuf_copym(nd->nd_nam, 0, MBUF_COPYALL, MBUF_WAITOK, &rp->rc_nam);
336 rp->rc_flag |= RC_NAM;
339 rp->rc_proc = nd->nd_procnum;
340 LIST_INSERT_HEAD(NFSRCHASH(nd->nd_retxid), rp, rc_hash);
341 rp->rc_flag &= ~RC_LOCKED;
342 if (rp->rc_flag & RC_WANTED) {
343 rp->rc_flag &= ~RC_WANTED;
344 wakeup(rp);
359 struct nfsrvcache *rp;
366 for (rp = NFSRCHASH(nd->nd_retxid)->lh_first; rp != 0;
367 rp = rp->rc_hash.le_next) {
368 if (nd->nd_retxid == rp->rc_xid && nd->nd_procnum == rp->rc_proc &&
369 netaddr_match(AF_INET, &rp->rc_haddr, nd->nd_nam)) {
370 if ((rp->rc_flag & RC_LOCKED) != 0) {
371 rp->rc_flag |= RC_WANTED;
372 msleep(rp, nfsrv_reqcache_mutex, PZERO-1, "nfsrc", NULL);
375 rp->rc_flag |= RC_LOCKED;
376 if (rp->rc_state == RC_DONE) {
383 if (rp->rc_flag & RC_REPMBUF) {
384 mbuf_freem(rp->rc_reply);
385 rp->rc_flag &= ~RC_REPMBUF;
388 rp->rc_state = RC_DONE;
396 rp->rc_status = nd->nd_repstat;
397 rp->rc_flag |= RC_REPSTATUS;
399 error = mbuf_copym(repmbuf, 0, MBUF_COPYALL, MBUF_WAITOK, &rp->rc_reply);
401 rp->rc_flag |= RC_REPMBUF;
404 rp->rc_flag &= ~RC_LOCKED;
405 if (rp->rc_flag & RC_WANTED) {
406 rp->rc_flag &= ~RC_WANTED;
407 wakeup(rp);
422 struct nfsrvcache *rp, *nextrp;
425 for (rp = nfsrv_reqcache_lruhead.tqh_first; rp != 0; rp = nextrp) {
426 nextrp = rp->rc_lru.tqe_next;
427 LIST_REMOVE(rp, rc_hash);
428 TAILQ_REMOVE(&nfsrv_reqcache_lruhead, rp, rc_lru);
429 _FREE(rp, M_NFSD);