Skip to contentSkip to conversation

NFSv4.1: retain MDS I/O until both thresholds are met

PATCH New Avi Weiss 1 participant 1 message Oct 16

Subsystems (2)
lore
Share & tools
lore

Avi Weiss

author
#0 lore raw

PATCH 1/1 NFSv4.1: retain MDS I/O until both thresholds are met

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")

---
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(-)
fs/nfs/pnfs.c +1 -1
index 4f9c0f639014..0d8f9636427b 100644
@@ -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

Signature · 1 line
2.43.0