Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 217207
b: refs/heads/master
c: 0649752
h: refs/heads/master
i:
  217205: 7ea18b9
  217203: 11715e2
  217199: ca8a83a
v: v3
  • Loading branch information
J. Bruce Fields committed Sep 20, 2010
1 parent 05df8c2 commit decec04
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c88739b373e4930ed082a607cb78bf82616fd076
refs/heads/master: 06497524589f2a7717da33969d541674e0a27da6
24 changes: 20 additions & 4 deletions trunk/net/sunrpc/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,23 @@ static void warn_no_listener(struct cache_detail *detail)
}
}

static bool cache_listeners_exist(struct cache_detail *detail)
{
if (atomic_read(&detail->readers))
return true;
if (detail->last_close == 0)
/* This cache was never opened */
return false;
if (detail->last_close < seconds_since_boot() - 30)
/*
* We allow for the possibility that someone might
* restart a userspace daemon without restarting the
* server; but after 30 seconds, we give up.
*/
return false;
return true;
}

/*
* register an upcall request to user-space and queue it up for read() by the
* upcall daemon.
Expand All @@ -1109,10 +1126,9 @@ int sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h,
char *bp;
int len;

if (atomic_read(&detail->readers) == 0 &&
detail->last_close < seconds_since_boot() - 30) {
warn_no_listener(detail);
return -EINVAL;
if (!cache_listeners_exist(detail)) {
warn_no_listener(detail);
return -EINVAL;
}

buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
Expand Down

0 comments on commit decec04

Please sign in to comment.