Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2510848rwe; Sun, 28 Aug 2022 13:44:46 -0700 (PDT) X-Google-Smtp-Source: AA6agR71jKmeE7bIhs2KmHauq3lwHG0ot5KUKPnafwKHC/xu9qFLwuIH4MjqQ7qrWCmuYG6FyZJN X-Received: by 2002:a17:906:db03:b0:741:337e:3600 with SMTP id xj3-20020a170906db0300b00741337e3600mr7477935ejb.343.1661719486432; Sun, 28 Aug 2022 13:44:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661719486; cv=none; d=google.com; s=arc-20160816; b=Aaqax2gWC7GbITPhwfGUBma9tnpGNU/qp69p1epD3xwJaGHW2lmSOYlFPmUxSuKCPS 5BupxTMdcGj3XezuGFTfyAnuf64SElLRlxSTDuYZTMr1UWVQv5Jo5YqzKg5k85mnexC8 t7ceBqNh0aOkin3Dkq0YDSktL90tnWsJcf7JITX9it7dFRVKNEjzb0LlFE/Zyko0yj7J WXXp6ZvaxmJjx75VsQFELOQ13In2jIlM08lREFIlJeOArFo44wit2sy4boSGjuJkMIpb odarTLittseHEDHhPmr3FwbBVqgTJQ4+Dmq2m5xuHPlwdxCwGWKqrQ3HAfFiHFr3WQi3 EHYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=1rMGuawy0pJApLd24jrSMrfxtjZq6FZ/4jmHYjjVumU=; b=D596K1UvS1/8p849WNc8ZW8dp5XWlIDL+tG6UBCGiUdrdVB+76LnQQeorUlSoUqqYR fn690uMV5XeqKA9w3MgBudozIwiRVtMHHdSOPqF+NIr59pba38as91CqJFzvmYbS8KTS R7P37KqfX9Xy5m1qI2MxD4dA2rundXUMyRteDUKGurbBW6W5UQI/GhcDGVAZy5tHZYxX 4LKQSXnf29SIjfJpzMBtv0B00t72fo31PO8iB9eCkfFw8FQYItQBNVfetkXcGVHJpFFo JHayw8lSI++Uv6G8v0kC9a67B7pz8SZzy+F5NqrPwI7vz5adzLlEuCO0CxXg6HagkUNI ip2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JUryzXbY; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di19-20020a170906731300b0073d6a126ca1si5783250ejc.541.2022.08.28.13.44.21; Sun, 28 Aug 2022 13:44:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JUryzXbY; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229585AbiH1UjX (ORCPT + 99 others); Sun, 28 Aug 2022 16:39:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229491AbiH1UjW (ORCPT ); Sun, 28 Aug 2022 16:39:22 -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 ECE4325C6E for ; Sun, 28 Aug 2022 13:39:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661719159; 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=1rMGuawy0pJApLd24jrSMrfxtjZq6FZ/4jmHYjjVumU=; b=JUryzXbYtO/ccLyHhInGMXp/enNT2PQn0bvDFyM01WenBtotl2j8vW8fa8fjNwyd4J9Am+ tS8PpMqVHt/DRWAvbkw9G81bsnoX40vhX9j9zPdeIKtdjn9NL9A/bIv0slv207W7Sofj13 rB99AmwJI/rO8f+X7nPANLFTxl1y4uc= 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-319-U3G7N4lgOj-5CB_kYrofHA-1; Sun, 28 Aug 2022 16:39:16 -0400 X-MC-Unique: U3G7N4lgOj-5CB_kYrofHA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 025D2811E76; Sun, 28 Aug 2022 20:39:16 +0000 (UTC) Received: from dwysocha.rdu.csb (unknown [10.22.8.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A256340C141D; Sun, 28 Aug 2022 20:39:14 +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: [RFC PATCH v2 0/3] Convert NFS with fscache to the netfs API Date: Sun, 28 Aug 2022 16:39:10 -0400 Message-Id: <20220828203913.956306-1-dwysocha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 v1 - PATCH 2,3: #ifdef CONFIG_NFS_FSCACHE all netfs bits - PATCH 3: Minimize changes to nfs_read_folio - PATCH 3: Add spinlock around updating of RPC accounting info inside nfs_complete_read (this resolved previous hang issue #3 on generic/075) The patches are moving in the right direction, and is the best I have come up with so far to move things forward. The patches are fairly stable as evidenced with xfstests generic with various servers. 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 with xfstests involving directIO writes + reads * seen with NFSv4.1, NetApp (ontap9) NFS server * seen one time with generic/209, one time with generic/451 * root of the problem is the added netfs RPC accounting is not handling read errors such as BAD_STATEID properly; might need to move the logic to anothe location such as nfs_initiate_read() and nfs_readpage_done() 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-rc2 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(-) -- 2.31.1