From patchwork Tue Nov 17 11:52:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 7636101 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 57682BF90C for ; Tue, 17 Nov 2015 11:53:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 75E07204EA for ; Tue, 17 Nov 2015 11:53:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 98F75204E2 for ; Tue, 17 Nov 2015 11:53:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752610AbbKQLxf (ORCPT ); Tue, 17 Nov 2015 06:53:35 -0500 Received: from mail-qk0-f179.google.com ([209.85.220.179]:36817 "EHLO mail-qk0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753452AbbKQLxa (ORCPT ); Tue, 17 Nov 2015 06:53:30 -0500 Received: by qkda6 with SMTP id a6so1674857qkd.3 for ; Tue, 17 Nov 2015 03:53:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poochiereds_net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hVI237naB+YJTn73wcm0lBW9jCIBQllCRgDLgzRulRM=; b=17eWCkIRq6cBzAS5JjDYdMxK3TSKt/GMe4w945CBrfu0AqH0vl28sfVRpRVWGSPtJd fdUMRQbytOmfTPV++w1B84HOi8fR3nXA+pdu0jChOgHr6otzUg3IRvOPU0GRwUmZkhqg v/SaUJdub4qXO+fATJv7vJZA18OjM4z9JHoO4MsXMraNvJjnzpQHB9sSJbT+sylScLnV kvzjK0RUZocnz1Kgu5uraXDbQRZ24l/Mtc9hPGdtKm9AavgEn7S+mJaHBpCxHlFOTZWd FhWKxMTsGzCU1Jsvoa1suvF+hSeLpEEMRBBfu19zd8ZoIs3+T5TkIYUwFIq3zRqoncyq ZLsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hVI237naB+YJTn73wcm0lBW9jCIBQllCRgDLgzRulRM=; b=SmLn0Q4/xMhnrOoV92biJma1QZXLSgY9/lavdeaS2JPebomVInojM0exQ+wNiMQKMy oF6MJCURxbEVNlvCcUExaxUOdTf4DABr2OBnprcVq08mC8CBJE1sKlEXpwj8ZsOT+/sH +N5T1UsDmM32Eo6XnfXCiGg1UHcD7y4Pn8tCQPhcBikqTfUKs8c1s/184KgtjRuDOsn7 LbiBtPOVhAVz+Lfjpq15TAQy5sXrsiETWGQf6BR74SLVoILhZ4w+uPlyiQapvY/yDQHm 2wPCc9jpHCakytbcl87bbh98+z5SkgGTuHVT09mNkcEjpg6Jx3FfnnfR+6t/z5a/9Fi8 d5zQ== X-Gm-Message-State: ALoCoQn6PAIPka/6SJfP5uwX2ntez9DVyv7qocKIFeddZqe2oBvfs0Fa0YZ1bk+Aa11iEJJ7Zs0v X-Received: by 10.55.77.202 with SMTP id a193mr40626412qkb.48.1447761209290; Tue, 17 Nov 2015 03:53:29 -0800 (PST) Received: from tlielax.poochiereds.net ([2606:a000:1125:4075::d5a]) by smtp.googlemail.com with ESMTPSA id w10sm1583910qhc.16.2015.11.17.03.53.28 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Nov 2015 03:53:28 -0800 (PST) From: Jeff Layton X-Google-Original-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> X-Mailer: git-send-email 2.4.3 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-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }