From patchwork Wed Aug 31 00:50:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wysochanski X-Patchwork-Id: 12960228 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33618ECAAD4 for ; Wed, 31 Aug 2022 00:51:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229591AbiHaAvK (ORCPT ); Tue, 30 Aug 2022 20:51:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbiHaAvJ (ORCPT ); Tue, 30 Aug 2022 20:51:09 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB14D33A24 for ; Tue, 30 Aug 2022 17:50:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661907058; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=A8rBE+7JFY+czmuPJK/CvpGRu6lO2Vcjhw9PpCAvMAQ=; b=TBzrYHQk9yrF24CHiv6V0fdS7YnA3iIW9nAtfPh9xXJcW5RVTjiep70egt742XumhUMTNr ltPwFUxYXbVA17kgvjZHhQrmdbKlzoWEiQntTAYfd03HdZeMbNT0L+N+f6FMQYKikKMrVE M1mXWHCHtVkBL1QZirS6yxkPQg77vsY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-135-kpDPkuJpPJu5G2A5KcParw-1; Tue, 30 Aug 2022 20:50:55 -0400 X-MC-Unique: kpDPkuJpPJu5G2A5KcParw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A6ABF8037AF; Wed, 31 Aug 2022 00:50:54 +0000 (UTC) Received: from dwysocha.rdu.csb (unknown [10.22.8.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3F8D1492C3B; Wed, 31 Aug 2022 00:50:54 +0000 (UTC) From: Dave Wysochanski To: Anna Schumaker , Trond Myklebust , David Howells Cc: linux-nfs@vger.kernel.org, linux-cachefs@redhat.com, Benjamin Maynard , Daire Byrne Subject: [PATCH v3 0/3] Convert NFS with fscache to the netfs API Date: Tue, 30 Aug 2022 20:50:50 -0400 Message-Id: <20220831005053.1287363-1-dwysocha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org This patchset converts NFS with fscache non-direct READ IO paths to use the netfs API with a non-invasive approach. The existing NFS pgio layer does not need extensive changes, and is the best way so far I've found to address Trond's concerns about modifying the IO path [1] as well as only enabling netfs when fscache is configured and enabled [2]. I have not yet attempted performance comparisions to address Chuck Lever's concern [3], though this is probably less of a concern now, since netfs is not used unless fscache is configured and enabled. The main patch to be reviewed is patch #3 which converts nfs_read_folio and nfs_readahead. Changes since v2 (all PATCH 3) - Fix Aug 28 kernel test robot compile warning due to unusued 'inode' variable by removing dprintk (can bring back as a trace event if needed) - Rename nfs_issue_read to nfs_netfs_issue_read - Rename nfs_begin_cache_operation to nfs_netfs_begin_cache_operation - Add nfs_netfs_read_completion and move logic from read.c into fscache.c - Add nfs_netfs_read_initiate and nfs_netfs_read_done to handle netfs IO accounting updates (resolves prior hang with BAD_STATEID errors), moving logic out of pagelist.c The patches are fairly stable as evidenced with xfstests generic with various servers: hammerspace w/NFS4.2+fscache, NetApp(ontap9) NFSv4.1+fscache, and RHEL8 NFSv3+fscache. The known issues are as follows: 1. Unit test setting rsize < readahead does not properly read from fscache but re-reads data from the NFS server * This will be fixed once another linux-cachefs [4] patch to resolve "Stop read optimisation when folio removed from pagecache" 2. "Cache volume key already in use" after xfstest runs * xfstests (hammerspace with vers=4.2,fsc) shows the following on the console after some tests: "NFS: Cache volume key already in use (nfs,4.1,2,c50,cfe0100a,3,,,8000,100000,100000,bb8,ea60,7530,ea60,1)" * This may be fixed with another patch [4] that is in progress 3. Hang (RESOLVED) 4. Data corruption seen with unit test where rsize < readahead * Seen with vanilla 6.0-rc2 (did not occur on 5.19); likely unrelated to this patchset mount -o vers=4.2,fsc,rsize=8192 127.0.0.1:/export /mnt dd if=/dev/urandom of=/tmp/integrity-rsize-file1.bin bs=16k count=1 ./nfs-readahead.sh set /mnt 16384 dd if=/tmp/integrity-rsize-file1.bin of=/mnt/integrity-rsize-file1.bin bs=16k count=1 echo 3 > /proc/sys/vm/drop_caches md5sum /mnt/integrity-rsize-file1.bin /tmp/integrity-rsize-file1.bin md5sums don't match, MD5_NFS = 00eaf1a5bc1b3dfd54711db551619afa != MD5_LOCAL = e8d835c83ba1f1264869dc40673fa20c The patchset is based on 6.0-rc3 and has been pushed to github at: https://github.com/DaveWysochanskiRH/kernel/commits/nfs-fscache-netfs [1] https://lore.kernel.org/linux-nfs/9cfd5bc3cfc6abc2d3316b0387222e708d67f595.camel@hammerspace.com/ [2] https://lore.kernel.org/linux-nfs/da9200f1bded9b8b078a7aef227fd6b92eb028fb.camel@hammerspace.com/ [3] https://marc.info/?l=linux-nfs&m=160597917525083&w=4 [4] https://www.mail-archive.com/linux-cachefs@redhat.com/msg03043.html [5] https://marc.info/?l=linux-nfs&m=165962662200679&w=4 Dave Wysochanski (3): NFS: Rename readpage_async_filler to nfs_pageio_add_page NFS: Add support for netfs in struct nfs_inode and Kconfig NFS: Convert nfs_read_folio and nfs_readahead to netfs APIs fs/nfs/Kconfig | 1 + fs/nfs/delegation.c | 2 +- fs/nfs/dir.c | 2 +- fs/nfs/fscache.c | 191 ++++++++++++++++++--------------------- fs/nfs/fscache.h | 77 ++++++++-------- fs/nfs/inode.c | 8 +- fs/nfs/internal.h | 10 +- fs/nfs/pagelist.c | 14 +++ fs/nfs/pnfs.c | 12 +-- fs/nfs/read.c | 117 ++++++++---------------- fs/nfs/write.c | 2 +- include/linux/nfs_fs.h | 19 +--- include/linux/nfs_page.h | 1 + include/linux/nfs_xdr.h | 1 + 14 files changed, 210 insertions(+), 247 deletions(-)