[PATCH] NFSv4.1: retain MDS I/O until both thresholds are met
From: Avi Weiss
Date: Fri Oct 16 2026 - 11:23:40 EST
When both size and I/O thresholds are configured,
pnfs_within_mdsthreshold() uses size && io to decide whether to
keep I/O on the MDS. Both variables indicate an unmet threshold,
so reaching only one threshold returns false and may trigger
pNFS layout acquisition while the other threshold remains unmet.
Use logical OR instead of AND to stay with MDS I/O until both
thresholds are met, as recommended by RFC 8881 Section 5.12.6.
The new RFC contains the same threshold selection rule as RFC
5661 which is referenced in function comment.
Fixes: d23d61c8d351 ("NFSv4.1 test the mdsthreshold hint parameters")
Signed-off-by: Avi Weiss <thnkslprpt@xxxxxxxxx>
---
When size_set = true and io_set = true we reach this if block:
if (size && io)...
but it should be:
if (size || io)...
size io current (&&) with fix (||)
-----------------------------------------------
false false false false
false true false true
true false false true
true true true true
Both variables indicate an unmet threshold. A true return
retains MDS I/O rather than acquiring a pNFS layout.
fs/nfs/pnfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 4f9c0f639014..0d8f9636427b 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -2061,7 +2061,7 @@ static bool pnfs_within_mdsthreshold(struct nfs_open_context *ctx,
break;
}
if (size_set && io_set) {
- if (size && io)
+ if (size || io)
ret = true;
} else if (size || io)
ret = true;
base-commit: 2f2f7eeef8b0a1a9b9ca998231419873ccae8d4e
--
2.43.0