Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1075470ybi; Sun, 30 Jun 2019 06:55:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqw2I8xxaODmVXOPOjAxYQ1hbLpHQIfD+3Mh74Uruf+CizcKvwvKEgWpOFSnwKsAAMT35jU7 X-Received: by 2002:a17:902:2869:: with SMTP id e96mr22321841plb.203.1561902920161; Sun, 30 Jun 2019 06:55:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561902920; cv=none; d=google.com; s=arc-20160816; b=y4uCIubTnEZocKIYvfM229L8CZjKli62abTk+vmrJqWzLKSIiB9qqlgn229VBAcM2t Pg/iTtLaZPhCsoJAJgc31SlJoYF75DqWCiCcIQzadEetZtLwNCn/oRpc6jczXTjH4hA+ mfh/HMvVzXe5iisQBYOCYAkID+XvBNc5A9uufGS/1TN1f/86IHmJc2EF39LOIMSdtFjJ D4K5CSjhWp09n3fE/cBsFHEb0/BnFdxQIKSXLL5xpKO6cCNGFa0tbQ1phDsuEGxivkhs uC5dgPolrOtxMwH8D/b0/PFlVS26cLUU1kBl+ctmI2TjMk5Y5p/j9z7CFFbMbHjSaxAZ Jzyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uJQISiYeBNw/ErwgBXjdG4575zJj77MOUucRMpWDu8E=; b=WGJsZd1qZsAVGLVu/AEf6GL7hhRhT47h/9LwWU8d8g5y2RqVWn2HrxzwOrme+Hlbuf 0nNBH276ddgHe+PobuR1x4Xcl/DQgPi1+dS4k4tDkAfaZBcljj4nCi933tXszrbGKlcg ZlUKGIsHXWMExh9R9KexBFQRtIo5GolkXnDH4GMRVP2GJU1rHKhSwnhG0imiFkElAT0X Ze8ZVShHXzV7QA2JZZLPHKJsYhEFlnSOjWYgvaXrQfddxSVkY/c1bA/1NTQJT+hVb0d5 lvmbYA+Th1aetCb5u6fyzhMkR0OF7LglOmCPepGRnxGCU14ktsVgA0CrcW/jbuxP8mc7 x+5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Amx+zs+j; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1si7993256pff.127.2019.06.30.06.54.54; Sun, 30 Jun 2019 06:55:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Amx+zs+j; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726547AbfF3Nyw (ORCPT + 99 others); Sun, 30 Jun 2019 09:54:52 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:33077 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726500AbfF3Nyw (ORCPT ); Sun, 30 Jun 2019 09:54:52 -0400 Received: by mail-io1-f65.google.com with SMTP id u13so22795175iop.0; Sun, 30 Jun 2019 06:54:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uJQISiYeBNw/ErwgBXjdG4575zJj77MOUucRMpWDu8E=; b=Amx+zs+jqxuwfnOy7YTys1WQvbm1ORqiNaeYZ0+/JH0wvFBJtcT2+s3nkqOn2EghzP 7vBkjVnNqHd6FkTcq7pRrerdIKu0xeP5nI8F+auISQob4e6WXulgGIfdhhGYn1BjSljb fnAMd37SUI5L5SdzCfZZ/Pm5Hk2farLvH2frfh4ccOTEfANbdgAcdodajMrYim4KqxO1 BBBzIHxy2BmqZsyJ7h9sykLRC7JRa4N0ivRNWQgMcgH+0DtP9sFnjYgDsbprdYzksj+O Qui7DlJG1KLhobUvJl7jQfRtWBNPzH+m8kf0QCXnSilgO5rO+qMEKyOQqOSalF3pjkWq +gDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uJQISiYeBNw/ErwgBXjdG4575zJj77MOUucRMpWDu8E=; b=m39uJFsm2elcz9WRF8+gu3q663mEiJS2upOXfl6fbLz3Bn2TMYrIB+XWqCii9Au6+v E6mHHVEVgI2zbDdunkjovXO6zI2bHVnpaPyz/o9DLdHtXZQMGBZHxg3VNBt7Zpbmz9QG 4QoE0GlPYN0mHT9UeoutNKKYzPYHYkA03i53zQgWFbnpxpseITEntS7NOD4kwZi8TAya 2VXuCyIiZCpVD+2rj40fSv+whHDuzXkbbU4rxMRedytO8O9N/LBM4xneFKteBiUiyd1h G2J9ySDHW7Y7ske0dWYMlLhrbivJ80yLMJOjI1eg+pwbkh2OInSpBVAzA6Bm85QgGJs1 5PJA== X-Gm-Message-State: APjAAAVRL7ZBExTamUPcxszQEFy3LZG3TGFIl1+JdQf2JfxE0TgB673+ cyR64B5Y4trMKSjIhXFoQw== X-Received: by 2002:a02:c885:: with SMTP id m5mr22837003jao.101.1561902890491; Sun, 30 Jun 2019 06:54:50 -0700 (PDT) Received: from localhost.localdomain (50-124-245-189.alma.mi.frontiernet.net. [50.124.245.189]) by smtp.gmail.com with ESMTPSA id z17sm11930378iol.73.2019.06.30.06.54.48 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 30 Jun 2019 06:54:49 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: "J. Bruce Fields" , Chuck Lever Cc: Jeff Layton , linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 01/16] sunrpc: add a new cache_detail operation for when a cache is flushed Date: Sun, 30 Jun 2019 09:52:25 -0400 Message-Id: <20190630135240.7490-2-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190630135240.7490-1-trond.myklebust@hammerspace.com> References: <20190630135240.7490-1-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Jeff Layton 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 Signed-off-by: Trond Myklebust Signed-off-by: Trond Myklebust --- 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 c7f38e897174..dfa3ab97564a 100644 --- a/include/linux/sunrpc/cache.h +++ b/include/linux/sunrpc/cache.h @@ -87,6 +87,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 66fbb9d2fba7..195b46a4a512 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -1521,6 +1521,9 @@ static ssize_t write_flush(struct file *file, const char __user *buf, cd->nextcheck = now; cache_flush(); + if (cd->flush) + cd->flush(); + *ppos += count; return count; } -- 2.21.0