Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1827459ybl; Sun, 18 Aug 2019 11:21:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzcKqR67LjdSgHtvDMxeKdXzhBpLZd3dO2o0xFTqXT2mhzTbBQH6TNO5a7uLpPspTuCiIS1 X-Received: by 2002:a17:90a:bf91:: with SMTP id d17mr10467064pjs.111.1566152499041; Sun, 18 Aug 2019 11:21:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566152499; cv=none; d=google.com; s=arc-20160816; b=HeO+eXpRF6BI+/Ueak64f7KT39nSi2Zr1E37yKwkSw0ohHYQ/zAYfRWpZBUb/vhZ2Z wDlAsDpOSz3L4YTc3v1eC92HCl7LkT95N4leScMC/8/07wqtsm67pZAV2sp+Xm0hL3jU 743gx65+Y1QN+SerkG4mVhK0pUcRMUYawxF/BCj9R6DZre2FmeTArFhR3TI8C+4K2/Nv 81m9X35lN32MzCzH8gULt0zinbHIMYgCKfYzcNk+ephv2q3PI/dBQ86svOC4+Rv0HDvV 1UMpo7H2FLkMOrOimVqfOfKr5bCz6+OWrVMRcBAHIV45uyybE+gzXb1Rrl6TctJ2ypI6 YkhQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=8GE+H4lHDFBjgHsBVUQI6N/9/0x4WTrPdZsB9ZY0txw=; b=JM6wm1z50t/IxH0tQE4NgvkfKnWLukYSK/etJAqy4zs71svBypQfiN9HOz5YYxckmN +K5O/y46pOaV+QBCknAHiT7onG8qJFhCG4rJs4vr5aqwArq7+V6LZCml8/2nl43ke8DM plC1KTvmtiDcCaDeUk6PwlT3QefGN/C8p3VeDSWY6feruJhoUL25YgIUotRHBzd+xHke 0GBkBa7t4mAlRwpS+2G96msMC8Xdu+vktPoYtALJfb+uK65FwDbu/8Bog5vliQ40kFPW McQb8kVm3PE7fjh7CxhBtwvrosPvRwZ0uoE04DVHMilIliRkWp8MWW8gi29U/YGnknT4 JkpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PKIIMkAz; 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 70si8351669ple.282.2019.08.18.11.21.10; Sun, 18 Aug 2019 11:21:39 -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=PKIIMkAz; 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 S1726926AbfHRSVI (ORCPT + 99 others); Sun, 18 Aug 2019 14:21:08 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:32780 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726115AbfHRSVI (ORCPT ); Sun, 18 Aug 2019 14:21:08 -0400 Received: by mail-io1-f67.google.com with SMTP id z3so16095764iog.0 for ; Sun, 18 Aug 2019 11:21:07 -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:mime-version :content-transfer-encoding; bh=8GE+H4lHDFBjgHsBVUQI6N/9/0x4WTrPdZsB9ZY0txw=; b=PKIIMkAzmM+7nfQxpJlxc5p8RU3Ssvn4nRr/N3WMMqWJ6WgOJZDkRXZDg1hThUCpub QSmtA9o1+qizPkGT6bfaN8RW/qsw0vJqxX7VTGIuMgzYdaG4Euiuz3mud6l7WUvvDjfM zEldKnhBHTwTWDYDi4kprHtjyZ2rLwQpJJESPC58ZhcNnldPNoq+BTkkRROW0hFr1Mol CFjlKl0d5X7jW02BTT2n8D0K6htf9y5I7bNPNR9q00FjVP3zXpiiO0beIXgweaz+gO+5 QepoiWO5HOYnhtukxwGrtgMApH2oYOI0Qng7zjAOSP29audv2oIs/v4Mc20zV519OUVj cjpA== 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:mime-version :content-transfer-encoding; bh=8GE+H4lHDFBjgHsBVUQI6N/9/0x4WTrPdZsB9ZY0txw=; b=DXLY5FQ6iN/h1qiowXis2T8OLP0V5RUBPiFMz2uUm/HZCaVp7AmRLU+EogUx1Sjlym sGjMFvJfaUw1M1ocFIamkcykapUFOOba2SYBpnnqKTuMJa4nKNMl5lY2kU7dkNF2FZwn yD2qESkztEB0IRwH/sweplNP6x7JRXQ9Kw6scyjeK86gd6EYafNmGh6ukmU/AWDwYoeX Ycg4iwuCYNtMCddhuEUI1sWgaDANF/LCJ0dFnjwEGI4Tg1DgwFw8T6/HGbfkQOyLwNRd 5lz+9M6vnssVMOXDV80fNMfgDy/N/KuK8O/zfQ7r1YUHV6sE9JpYijTEIzD+PgEonx9s 8dKw== X-Gm-Message-State: APjAAAUSMrewWfdOpkQFTbgqfzMf0h7ORPaPsf6IqlSa4WR+rGETqBzY zJeKK4+WfeaSi8CMrOcbPgbyqTU= X-Received: by 2002:a5e:9314:: with SMTP id k20mr22518713iom.235.1566152467018; Sun, 18 Aug 2019 11:21:07 -0700 (PDT) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id n22sm10317844iob.37.2019.08.18.11.21.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Aug 2019 11:21:06 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: "J. Bruce Fields" Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 00/16] Cache open file descriptors in knfsd Date: Sun, 18 Aug 2019 14:18:43 -0400 Message-Id: <20190818181859.8458-1-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.21.0 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 When a NFSv3 READ or WRITE request comes in, the first thing knfsd has to do is open a new file descriptor. While this is often a relatively inexpensive thing to do for most local filesystems, it is usually less so for FUSE, clustered or networked filesystems that are being exported by knfsd. This set of patches attempts to reduce some of that cost by caching open file descriptors so that they may be reused by other incoming READ/WRITE requests for the same file. One danger when doing this, is that knfsd may end up caching file descriptors for files that have been unlinked. In order to deal with this issue, we use fsnotify to monitor the files, and have hooks to evict those descriptors from the file cache if the i_nlink value goes to 0. ------- v2: - Fix a double semicolon in fs/nfsd/filecache.c - Adjust changelog for "nfsd: rip out the raparms cache" as per Chuck's request. ------- Jeff Layton (12): sunrpc: add a new cache_detail operation for when a cache is flushed locks: create a new notifier chain for lease attempts nfsd: add a new struct file caching facility to nfsd nfsd: hook up nfsd_write to the new nfsd_file cache nfsd: hook up nfsd_read to the nfsd_file cache nfsd: hook nfsd_commit up to the nfsd_file cache nfsd: convert nfs4_file->fi_fds array to use nfsd_files nfsd: convert fi_deleg_file and ls_file fields to nfsd_file nfsd: hook up nfs4_preprocess_stateid_op to the nfsd_file cache nfsd: have nfsd_test_lock use the nfsd_file cache nfsd: rip out the raparms cache nfsd: close cached files prior to a REMOVE or RENAME that would replace target Trond Myklebust (4): notify: export symbols for use by the knfsd file cache vfs: Export flush_delayed_fput for use by knfsd. nfsd: Fix up some unused variable warnings nfsd: Fix the documentation for svcxdr_tmpalloc() fs/file_table.c | 1 + fs/locks.c | 61 +++ fs/nfsd/Kconfig | 1 + fs/nfsd/Makefile | 3 +- fs/nfsd/blocklayout.c | 3 +- fs/nfsd/export.c | 13 + fs/nfsd/filecache.c | 885 +++++++++++++++++++++++++++++++ fs/nfsd/filecache.h | 60 +++ fs/nfsd/nfs4layouts.c | 12 +- fs/nfsd/nfs4proc.c | 83 +-- fs/nfsd/nfs4state.c | 183 ++++--- fs/nfsd/nfs4xdr.c | 31 +- fs/nfsd/nfssvc.c | 16 +- fs/nfsd/state.h | 10 +- fs/nfsd/trace.h | 140 +++++ fs/nfsd/vfs.c | 295 ++++------- fs/nfsd/vfs.h | 9 +- fs/nfsd/xdr4.h | 19 +- fs/notify/fsnotify.h | 2 - fs/notify/group.c | 2 + fs/notify/mark.c | 6 + include/linux/fs.h | 5 + include/linux/fsnotify_backend.h | 2 + include/linux/sunrpc/cache.h | 1 + net/sunrpc/cache.c | 3 + 25 files changed, 1464 insertions(+), 382 deletions(-) create mode 100644 fs/nfsd/filecache.c create mode 100644 fs/nfsd/filecache.h -- 2.21.0