Skip to content

Commit f69d6d8

Browse files
Jeff LaytonJ. Bruce Fields
authored andcommitted
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: Jeff Layton <[email protected]> Signed-off-by: Trond Myklebust <[email protected]> Signed-off-by: Trond Myklebust <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
1 parent 4866073 commit f69d6d8

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

include/linux/sunrpc/cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ struct cache_detail {
8787
int has_died);
8888

8989
struct cache_head * (*alloc)(void);
90+
void (*flush)(void);
9091
int (*match)(struct cache_head *orig, struct cache_head *new);
9192
void (*init)(struct cache_head *orig, struct cache_head *new);
9293
void (*update)(struct cache_head *orig, struct cache_head *new);

net/sunrpc/cache.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,6 +1524,9 @@ static ssize_t write_flush(struct file *file, const char __user *buf,
15241524
cd->nextcheck = now;
15251525
cache_flush();
15261526

1527+
if (cd->flush)
1528+
cd->flush();
1529+
15271530
*ppos += count;
15281531
return count;
15291532
}

0 commit comments

Comments
 (0)