2024-03-15 17:11:32

by Jeffrey Layton

[permalink] [raw]
Subject: [PATCH RFC 24/24] nfs: add a module parameter to disable directory delegations

For testing purposes, add a module parameter that will prevent the
client from requesting further directory delegations.

Signed-off-by: Jeff Layton <[email protected]>
---
fs/nfs/nfs4proc.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 3dbe9a18c9be..a85a594cad88 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4318,8 +4318,14 @@ static int nfs4_get_referral(struct rpc_clnt *client, struct inode *dir,
return status;
}

+static bool nfs_dir_delegation_enabled = true;
+module_param(nfs_dir_delegation_enabled, bool, 0644);
+MODULE_PARM_DESC(nfs_dir_delegation_enabled, "Enable directory delegations?");
+
static bool should_request_dir_deleg(struct inode *inode)
{
+ if (!nfs_dir_delegation_enabled)
+ return false;
if (!inode)
return false;
if (!S_ISDIR(inode->i_mode))

--
2.44.0