From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.49 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796316880; b=YbVZv72y0JrHOGNCH49FBpiOIJoFYK/s47RrQygkQI4YWEblrowF7DCs4S382RBM/CPJ iEb70XmmwmFVMTbulDAcYtQ5a1uQVzPlRp2Kvfdy75ubuZFWkrAbC9o8tL3Xn1ZmY4GaE wNZ0b7UkxH3k3tqkoyp+lfWpu4gNnXRLpkhl0FV0TzGRfJaLEd2FBXH4y/GKGQuew3s/A hU6OtwMfRCZ2RZprb0WcAUBNV850RLqeVLXsrtQf+XMHVFqRFQjE6AHcDiILaz36FVs1o SF9IYsXJArWcaEGzCaGHWGNlj3yAjvytpRkaDGvmVve/gszaksmdSDlbXWRxddQcjAA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796316880; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=808UWGO70XyS3yJ/OYRHrODQi6GgPwnn7ar8QU5Qmuc=; b=jl/yxQv8HYTXOx2FbcFg0KKAqU084l7zKGzp+7gQBJPSStQhJN1v7ywWh28OHBcJ2Th2 4s4hPaApOCxJbOb9+qR98QUlGisckmU76qKKeqAEnzSC+EI5Gj5VdtMR+ZO/uqPA4KLmE EFwOUquyEtnfxLL6/1PIEJPL80cNTx9kNM20TwZAK9tIcm//ftfM5p+ALQPzV2nM21rs/ 5aogCG+/zzwJNwmyDJr+HOpXxqmAAohhGdpnqfGczcZwzO3qtbP5Q7BPLeWBnqeyCO1O0 fWOzFTtAWU6RgJnMObYoab4rOUNNO4TVD3eZ26iuS2lNFBrYxGozqH2LLNWIdWFLDYg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=hammerspace.com; spf=pass smtp.mailfrom=hammerspace.com; dkim=pass header.d=hammerspace.com header.i=@hammerspace.com header.a=rsa-sha256 header.s=google header.b=UW4tv9po; arc=none smtp.remote-ip=209.85.210.49 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66A9A606A322 for ; Thu, 3 Dec 2026 16:54:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 66A9A606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=hammerspace.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hammerspace.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=hammerspace.com header.i=@hammerspace.com header.a=rsa-sha256 header.s=google header.b=UW4tv9po Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-844a8bf7e25so48027a34.1 for ; Thu, 03 Dec 2026 08:54:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hammerspace.com; s=google; t=1796316879; x=1796921679; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=808UWGO70XyS3yJ/OYRHrODQi6GgPwnn7ar8QU5Qmuc=; b=UW4tv9po2PlEHx4a8PukgQi/wXXRMCnUwr7RRdmOeKH4MBB3m3TNKOHAzBRtwdWUMV dfsU98VbfW9OSbuVAY+d2Z+euoZi2Vy5Gr6SC1M1gE90Ijyve8BGRi26P6uWp4PcgSaC J1FiP88MIDMNcaA/qGaktHo5eUMeWjsQkRsVNiHJgw6CNQw0sibYGWA5OPgSXGQHCVnP KozIgNo9fBV09HgVFbsF8zXn/2e3J9mCHmHWKejK4v+B4DoxfnVPBi4g7BPfeLmggxK6 Lv1Ni7laOBtvcPvtlSOUJiWXFfVKtJ/KoWWunQezNqyS6/aqiMY3saLt6uWzJSJpvMgz Ztwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796316879; x=1796921679; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=808UWGO70XyS3yJ/OYRHrODQi6GgPwnn7ar8QU5Qmuc=; b=OyV/KdlLyMeES4h725+eqM6XrudohBRj1j1cjntnaEXp9Kw4m1912VxGg/xNXY1qAn 7UfJUkSwHOaMh9RSI5faiYDS1tjfrJxfq567yKts1dkYsmbzNPzoEKxgsW/zU+n0tnQS RlRqiKayeoVn1Jj4Wwh0ZsoEm99gJ/MZ0gGu6GC1UWRAxFBj2cMHCX+apCntY9Njrph5 q9PEA+FRQ+mUv3rBc2+3dTMmqA4923lkl0XeQYCy4W2aRtTu11BZFP9SzWtk6GY8bh6K 6ObsPYXp9MlQT7WwZtmbrXs9wDavGZ/MvhR8+2Z8DmAd2GR2eAUwcHfmycgIS65dadel Z6Mg== X-Forwarded-Encrypted: i=1; AL+hErH+2QH4rCCdmmqLMkcYzei5Bx+iYTv/y+keVCweWe8ALnBO5D4LQVEUHfjUrACg8TGT6eZ/pXeusUM=@vger.kernel.org X-Gm-Message-State: APuU4Z/P+lm1b1rl6HmYiZHL1A1OQaoGFhTQkYBqhIL8KsmUsOPBJNCD MVYZzoHpRTy0x5t70gphO58szHbN/1w+09wWA5JERCvRUWsxWx/AJrXEer+qcBV0UHg= X-Gm-Gg: AZFdTZfg8p9jXfhhQyw4PHmuAYVGGTJ/MAsZcLWgUWmB3Rx9pEhSaWUqOKRIF+dOENz B4Po/EY3RDyL7D7kBx8i360niJMjlBnMPlRdrkhjhku52pzFiGOhmqLKK+y6ndiJB6pWkfTy/MN e8qmQEbreHHQiXZpu0BNMMY73TgpU1doQyk/SNYlgKGPj4gjcko7QhufV3gOqufHFm/GBUmvWY2 MEpLOX2XnLLLFEr7JCa0PFWcYxVDnOdAkkcoc/EqZfil+7gI0wFvjKqRVeBs5Do/2fEqNRd4IYT MRzv17KRBb/G4vqyODbV/fWbZrdjOly/daRbO0oYoaDFj0obG5frAKgI2Lf8/+1VgMAv3DX10Eo zUj2JXweEW2JbFcDNHXR3HifFFlivn34oNvXAKKn5Bm5A9b6Tnrv4ydat42nqRtyJ6gxCR5FDoW /tZPmFOVL9y3X6vfkbm2gmb1KJySc9fN+BpERgwk+ZJI8O/EhIEn3+11CsLzQ3XjqAKw21rNuZx mNyhTUQpv7fUfVNEbunPDYxk8eV67biN4umDyyIrazDAFiWH/0Iiy/VDTL6XYn1QPGLCqeg0QvL m0QuW9IrNPd6Ub8urwbQxgfOZKhdHGRpRCN+l3eeZau680WbzuJTa2SvBgjDX0AE4AbOUjBx X-Received: by 2002:a05:6830:718b:b0:862:ba3a:f064 with SMTP id 46e09a7af769-86314fe7a61mr46397455a34.0.1796316879272; Thu, 03 Dec 2026 08:54:39 -0800 (PST) Received: from bcodding.csb.hammerspace.com ([66.97.168.37]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-863168dcf38sm31827030a34.9.2026.12.03.08.54.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 08:54:38 -0800 (PST) From: Benjamin Coddington To: Trond Myklebust , Anna Schumaker , Mike Snitzer Cc: Olga Kornievskaia , linux-nfs@vger.kernel.org Subject: [PATCH v4 0/4] pNFS/flexfiles: I/O without a layout under FF_FLAGS_NO_IO_THRU_MDS Date: Thu, 3 Dec 2026 11:54:33 -0500 Message-ID: X-Mailer: git-send-email 2.53.0 X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Benjamin Coddington When a file's flexfiles layouts carry FF_FLAGS_NO_IO_THRU_MDS, the client keeps reads and writes off the MDS when it has no layout segment for them. Reads and writes handle that differently: - Reads test the inode's NFS_INO_NO_IO_THRU_MDS bit, wait a second between attempts, and honour io_maxretrans on soft mounts. - Writes test a bit on the layout header and return -EAGAIN. nfs_writepages() resends at once, so a writer spins for as long as there is no layout. Once the header is freed the bit is gone and writes go through the MDS, and ff_layout_pg_init_write() sends them there whenever pnfs_generic_pg_check_layout() drops an invalidated segment. Neither direction uses the MDS when the server has said there is no layout to give. After NFS4ERR_LAYOUTUNAVAILABLE, RFC 8435 says the I/O is to go to the MDS (section 5.1.1). Today reads wait and writes spin until the 120 second fail bit expires, then send a LAYOUTGET that can fail the same way. Patch 1 has writes test the inode bit in both places, and paces nfs_writepages(): the first resend after -EAGAIN is immediate, then data-integrity writeback waits a second before each resend and other writeback leaves the folios dirty. Patch 2 removes the header bit, which nothing tests after patch 1. Patch 3 sends reads, writes and the resend after a data server error through the MDS while the fail bit for their iomode is set. Patch 4 fixes two older MDS-fallback tracepoints that read the layout header without i_lock, as patch 1 does for the one it moves. Patch 3 is how the server sends I/O to the MDS, as Trond described in the v3 review: the client reports a data server it can't use with LAYOUTERROR or LAYOUTRETURN, and the server decides whether to answer the next LAYOUTGET with NFS4ERR_LAYOUTUNAVAILABLE. The client sends no other I/O for these files through the MDS. This is the rest of the v3 series, on top of "pNFS: layout recalls and writes that have to be resent": https://lore.kernel.org/linux-nfs/cover.1796306148.git.bcodding@hammerspace.com/ That series has what v3's 1/5 and 2/5 were for. Its patch 10 has nfs_wb_folio() wait and resend a refused folio, its patch 5 is v3's 2/5, and its patch 6 paces the O_DIRECT resend. Tested on a KASAN kernel against a reffs MDS that hands out six-way mirrored flexfiles layouts with FF_FLAGS_NO_IO_THRU_MDS, with knfsd as the NFSv3 data server, injecting LAYOUTGET errors after a file recall: - With NFS4ERR_LAYOUTUNAVAILABLE, reads and writes go through the MDS at once, and the data written through the MDS is on every mirror. That includes writeback stopped after queueing its first folio, with a test-only delay, when the recall and the error arrive: the queued folio and the rest go through the MDS. - With a retryable error (NFS4ERR_SERVERFAULT) held for 6 to 8 seconds, fsync retries once a second with no I/O to the MDS. On the base it resends without a pause, or writes through the MDS once the layout header is gone. SIGKILL ends a writer blocked in fsync, sync_file_range(SYNC_FILE_RANGE_WRITE) returns 0, and a soft mount with io_maxretrans=3 returns EIO after about 2 seconds. A read of a folio that another open context had dirtied waits for the layout, flushes the folio to the data servers and returns the data. - The recall tests from the series this is based on still pass: buffered and O_DIRECT I/O under FSID, ALL and FILE recalls with every mirror checked, the O_DIRECT write from an mmap of the same file, writeback stopped between folios, and uncommitted UNSTABLE data. Not tested: layouts with a single mirror. The base is that series on Trond's testing branch at 3e1999173432. Changes since v3: https://lore.kernel.org/linux-nfs/cover.1795122899.git.bcodding@hammerspace.com/ - 1/5 (writeback of a locked folio through the MDS) is dropped, and pg_allow_mds with it. - 2/5 is patch 5 of the base series. - Patch 1 (was 3/5): the O_DIRECT changes are gone, since the base series paces that resend. nfs_writepages() waits after any second -EAGAIN, so the pg_nolayout descriptor bit is gone too, and the first resend is immediate. - Patches 2 and 3 (were 4/5 and 5/5): unchanged apart from a comment that mentioned pg_allow_mds. - New patch 4 (local sashiko review). Benjamin Coddington (4): pNFS/flexfiles: pace writes that have no layout and can't use the MDS pNFS/flexfiles: remove the layout-header NO_IO_THRU_MDS bit pNFS/flexfiles: use the MDS when the server has no layout to give pNFS/flexfiles: emit the pg_init MDS-fallback tracepoints under i_lock fs/nfs/flexfilelayout/flexfilelayout.c | 156 ++++++++++++++++--------- fs/nfs/flexfilelayout/flexfilelayout.h | 16 --- fs/nfs/internal.h | 10 +- fs/nfs/nfs4trace.c | 1 + fs/nfs/nfs4trace.h | 1 + fs/nfs/pnfs.c | 22 ++++ fs/nfs/pnfs.h | 1 + fs/nfs/write.c | 13 +++ 8 files changed, 144 insertions(+), 76 deletions(-) base-commit: 3e19991734326332c736e24c9b47b2cffb8f9e42 prerequisite-patch-id: 1bf389e0665f28a4f66068858631884b3ff270aa prerequisite-patch-id: 674a8beed30311c64efccf670996a549edf25c9e prerequisite-patch-id: 02c555c4e0f0ca007f265128080e777217679463 prerequisite-patch-id: b6845ef891faa85557c023fdae602004e258e122 prerequisite-patch-id: a1dfade3905aa336e6d6a296a3e056e105041072 prerequisite-patch-id: 30b5addaf02ea29abd0a5e446c35c8b71926ef81 prerequisite-patch-id: 3d02a5ce811d297818b0cb44a4ff616feaf4be0b prerequisite-patch-id: 4e11b1d4d8fa707791d03518391ec18d2b479f34 prerequisite-patch-id: dbeb9d6825f0bd79715266abd14f8da66bf085f5 prerequisite-patch-id: 5f6e4082c18157d4d185fb973c7faacb91badd2f prerequisite-patch-id: 64d6171847787b2db7444a73ae5a686afe8afb0c -- 2.53.0