]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sunrpc: add a new cache_detail operation for when a cache is flushed
authorJeff Layton <jlayton@poochiereds.net>
Tue, 20 Oct 2015 17:33:41 +0000 (13:33 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 23 Oct 2015 19:57:37 +0000 (15:57 -0400)
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 <jeff.layton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
include/linux/sunrpc/cache.h
net/sunrpc/cache.c

index ed03c9f7f908d7a477ef5349f35439b30b014b85..e67b35d75417a1cf4d2a37a8f9f3ffa02588a270 100644 (file)
@@ -100,6 +100,7 @@ struct cache_detail {
                                              int has_died);
 
        struct cache_head *     (*alloc)(void);
+       void                    (*flush)(void);
        int                     (*match)(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);
index 5e4f815c2b34d22fba11ac2443e9d66bc27c779c..19ee8feec8f33fa5d187f8a916bc2318300af3bb 100644 (file)
@@ -1478,6 +1478,9 @@ static ssize_t write_flush(struct file *file, const char __user *buf,
        cd->flush_time = then;
        cache_flush();
 
+       if (cd->flush)
+               cd->flush();
+
        *ppos += count;
        return count;
 }