Commit f69d6d8e authored by Jeff Layton's avatar Jeff Layton Committed by J. Bruce Fields

sunrpc: add a new cache_detail operation for when a cache is flushed

When the exports table is changed, exportfs will usually write a new
time to the "flush" file in the nfsd.export cache procfile. This tells
the kernel to flush any entries that are older than that value.

This gives us a mechanism to tell whether an unexport might have
occurred. Add a new ->flush cache_detail operation that is called after
flushing the cache whenever someone writes to a "flush" file.
Signed-off-by: default avatarJeff Layton <jeff.layton@primarydata.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 4866073e
...@@ -87,6 +87,7 @@ struct cache_detail { ...@@ -87,6 +87,7 @@ struct cache_detail {
int has_died); int has_died);
struct cache_head * (*alloc)(void); struct cache_head * (*alloc)(void);
void (*flush)(void);
int (*match)(struct cache_head *orig, struct cache_head *new); int (*match)(struct cache_head *orig, struct cache_head *new);
void (*init)(struct cache_head *orig, struct cache_head *new); void (*init)(struct cache_head *orig, struct cache_head *new);
void (*update)(struct cache_head *orig, struct cache_head *new); void (*update)(struct cache_head *orig, struct cache_head *new);
......
...@@ -1524,6 +1524,9 @@ static ssize_t write_flush(struct file *file, const char __user *buf, ...@@ -1524,6 +1524,9 @@ static ssize_t write_flush(struct file *file, const char __user *buf,
cd->nextcheck = now; cd->nextcheck = now;
cache_flush(); cache_flush();
if (cd->flush)
cd->flush();
*ppos += count; *ppos += count;
return count; return count;
} }
......
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