Skip to contentSkip to conversation

NFSD: send OP_CB_RECALL_ANY to clients when number of delegations reaches its limit

PATCH Superseded Dai Ngo 2 participants 3 messages Feb 20, 2024 – Feb 21, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Dai Ngo

author reviewer
#0 lore raw

PATCH 1/1 NFSD: send OP_CB_RECALL_ANY to clients when number of delegations reaches its limit

The NFS server should ask clients to voluntarily return unused delegations when the number of granted delegations reaches the max_delegations. This is so that the server can continue to hand out delegations for new requests.

---
 fs/nfsd/nfs4state.c | 3 +++
 1 file changed, 3 insertions(+)
fs/nfsd/nfs4state.c +3 -0
index fdc95bfbfbb6..a0bd6f6b994d 100644
@@ -130,6 +130,7 @@ static const struct nfsd4_callback_ops nfsd4_cb_notify_lock_ops;
 static const struct nfsd4_callback_ops nfsd4_cb_getattr_ops;
 
 static struct workqueue_struct *laundry_wq;
+static void deleg_reaper(struct nfsd_net *nn);
 
 int nfsd4_create_laundry_wq(void)
 {
@@ -6550,6 +6551,8 @@ nfs4_laundromat(struct nfsd_net *nn)
 	/* service the server-to-server copy delayed unmount list */
 	nfsd4_ssc_expire_umount(nn);
 #endif
+	if (atomic_long_read(&num_delegations) >= max_delegations)
+		deleg_reaper(nn);
 out:
 	return max_t(time64_t, lt.new_timeo, NFSD_LAUNDROMAT_MINTIMEOUT);
 }
Signature · 1 line
2.39.3
#1 lore raw

hi Dai,

Quoted 15 lines · Dai Ngo

The NFS server should ask clients to voluntarily return unused delegations when the number of granted delegations reaches the max_delegations. This is so that the server can continue to hand out delegations for new requests.

---
  fs/nfsd/nfs4state.c | 3 +++
  1 file changed, 3 insertions(+)
fs/nfsd/nfs4state.c +0 -0
index fdc95bfbfbb6..a0bd6f6b994d 100644

fs/nfsd/nfs4state.c static const struct nfsd4_callback_ops nfsd4_cb_notify_lock_ops; · line 133

Quoted 4 lines
fs/nfsd/nfs4state.c +1 -0
@@ -130,6 +130,7 @@ static const struct nfsd4_callback_ops nfsd4_cb_notify_lock_ops;
  static const struct nfsd4_callback_ops nfsd4_cb_getattr_ops;
 
  static struct workqueue_struct *laundry_wq;
+static void deleg_reaper(struct nfsd_net *nn);

Nits: If this is actually needed (you seem to be calling it after it is defined?), shouldn't it be with the other forward decls around lines 84–89?

cheers,
calum.

Quoted 12 lines
fs/nfsd/nfs4state.c +2 -0
  int nfsd4_create_laundry_wq(void)
  {
@@ -6550,6 +6551,8 @@ nfs4_laundromat(struct nfsd_net *nn)
  	/* service the server-to-server copy delayed unmount list */
  	nfsd4_ssc_expire_umount(nn);
  #endif
+	if (atomic_long_read(&num_delegations) >= max_delegations)
+		deleg_reaper(nn);
  out:
  	return max_t(time64_t, lt.new_timeo, NFSD_LAUNDROMAT_MINTIMEOUT);
  }
author reviewer
#2 lore raw
Quoted 13 lines · Calum Mackay

hi Dai,

Quoted 10 lines · Dai Ngo

The NFS server should ask clients to voluntarily return unused delegations when the number of granted delegations reaches the max_delegations. This is so that the server can continue to hand out delegations for new requests.

---
  fs/nfsd/nfs4state.c | 3 +++

  1 file changed, 3 insertions(+)
Quoted 11 lines

fs/nfsd/nfs4state.c static const struct nfsd4_callback_ops · line 133

Quoted 9 lines
fs/nfsd/nfs4state.c +1 -0
index fdc95bfbfbb6..a0bd6f6b994d 100644
@@ -130,6 +130,7 @@ static const struct nfsd4_callback_ops 
 nfsd4_cb_notify_lock_ops;
   static const struct nfsd4_callback_ops nfsd4_cb_getattr_ops;
     static struct workqueue_struct *laundry_wq;
+static void deleg_reaper(struct nfsd_net *nn);

Nits: If this is actually needed (you seem to be calling it after it is defined?),

Yes, it's needed for a clean build:

fs/nfsd/nfs4state.c:6554:17: error: implicit declaration of function ‘deleg_reaper’ [-Werror=implicit-function-declaration]

Quoted 1 line

shouldn't it be with the other forward decls around lines 84–89?

I'll move it up in v2.

Thanks,
-Dai

Quoted 17 lines

cheers,
calum.

Quoted 11 lines
fs/nfsd/nfs4state.c +2 -0
     int nfsd4_create_laundry_wq(void)
   {
@@ -6550,6 +6551,8 @@ nfs4_laundromat(struct nfsd_net *nn)
       /* service the server-to-server copy delayed unmount list */
       nfsd4_ssc_expire_umount(nn);
   #endif
+    if (atomic_long_read(&num_delegations) >= max_delegations)
+        deleg_reaper(nn);

  out:
      return max_t(time64_t, lt.new_timeo, NFSD_LAUNDROMAT_MINTIMEOUT); }