Return-Path: Received: from mail-qk0-f180.google.com ([209.85.220.180]:36817 "EHLO mail-qk0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753449AbbKQLx3 (ORCPT ); Tue, 17 Nov 2015 06:53:29 -0500 Received: by qkda6 with SMTP id a6so1674856qkd.3 for ; Tue, 17 Nov 2015 03:53:29 -0800 (PST) From: Jeff Layton To: bfields@fieldses.org, trond.myklebust@primarydata.com Cc: linux-nfs@vger.kernel.org, Eric Paris , Alexander Viro , linux-fsdevel@vger.kernel.org Subject: [PATCH v1 11/38] sunrpc: add a new cache_detail operation for when a cache is flushed Date: Tue, 17 Nov 2015 06:52:33 -0500 Message-Id: <1447761180-4250-12-git-send-email-jeff.layton@primarydata.com> In-Reply-To: <1447761180-4250-1-git-send-email-jeff.layton@primarydata.com> References: <1447761180-4250-1-git-send-email-jeff.layton@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org List-ID: 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 --- include/linux/sunrpc/cache.h | 1 + net/sunrpc/cache.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h index ed03c9f7f908..e67b35d75417 100644 --- a/include/linux/sunrpc/cache.h +++ b/include/linux/sunrpc/cache.h @@ -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); diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 5e4f815c2b34..19ee8feec8f3 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -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; } -- 2.4.3