Commit eeb6f17b authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] kNFSd: Add a warning when upcalls fail,

From: NeilBrown <neilb@cse.unsw.edu.au>

From: "J. Bruce Fields" <bfields@fieldses.org>

To help the user diagnose problems caused by user-level daemons not running.
parent 95321936
...@@ -97,7 +97,8 @@ struct cache_detail { ...@@ -97,7 +97,8 @@ struct cache_detail {
struct proc_dir_entry *flush_ent, *channel_ent, *content_ent; struct proc_dir_entry *flush_ent, *channel_ent, *content_ent;
atomic_t readers; /* how many time is /chennel open */ atomic_t readers; /* how many time is /chennel open */
time_t last_close; /* it no readers, when did last close */ time_t last_close; /* if no readers, when did last close */
time_t last_warn; /* when we last warned about no readers */
}; };
......
...@@ -214,6 +214,7 @@ void cache_register(struct cache_detail *cd) ...@@ -214,6 +214,7 @@ void cache_register(struct cache_detail *cd)
cd->entries = 0; cd->entries = 0;
atomic_set(&cd->readers, 0); atomic_set(&cd->readers, 0);
cd->last_close = 0; cd->last_close = 0;
cd->last_warn = -1;
list_add(&cd->others, &cache_list); list_add(&cd->others, &cache_list);
spin_unlock(&cache_list_lock); spin_unlock(&cache_list_lock);
...@@ -905,7 +906,15 @@ void qword_addhex(char **bpp, int *lp, char *buf, int blen) ...@@ -905,7 +906,15 @@ void qword_addhex(char **bpp, int *lp, char *buf, int blen)
*lp = len; *lp = len;
} }
void warn_no_listener(struct cache_detail *detail)
{
if (detail->last_warn != detail->last_close) {
detail->last_warn = detail->last_close;
printk(KERN_WARNING "nfsd: nobody listening for %s upcall;"
" has some daemon %s?\n", detail->name,
detail->last_close?"died" : "not been started");
}
}
/* /*
* register an upcall request to user-space. * register an upcall request to user-space.
...@@ -923,9 +932,10 @@ static int cache_make_upcall(struct cache_detail *detail, struct cache_head *h) ...@@ -923,9 +932,10 @@ static int cache_make_upcall(struct cache_detail *detail, struct cache_head *h)
return -EINVAL; return -EINVAL;
if (atomic_read(&detail->readers) == 0 && if (atomic_read(&detail->readers) == 0 &&
detail->last_close < get_seconds() - 60) detail->last_close < get_seconds() - 30) {
/* nobody is listening */ warn_no_listener(detail);
return -EINVAL; return -EINVAL;
}
buf = kmalloc(PAGE_SIZE, GFP_KERNEL); buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!buf) if (!buf)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment