Rajesh Prasad has uploaded this change for review.

View Change

Fix for NLM CLOSE_WAIT Socket Leak & negative AUTH refcount in NSM operations

NLM CLOSE_WAIT Issue - Fix in nlm_owner.c file

When using NFSv3 with NLM (Network Lock Manager), TCP callback connections
from NFS Ganesha to clients get stuck in CLOSE_WAIT state and are never
properly closed. This leads to socket exhaustion over time.

netstat command shows multiple CLOSE_WAIT connections

The remote peer (NLM client) sent FIN to close the connection. NFS Ganesha
received the FIN and ACKed it but Ganesha never close socket FD.
The socket remains in CLOSE_WAIT indefinitely until Ganesha restart.

Negative AUTH refcount Issue - Fix in nsm.c file

This change fixes a critical bug where AUTH_DESTROY() causes negative
reference counts (ah_refcnt) when called on authnone auth structures.

ROOT CAUSE:
1. authnone_ncreate() returns a shared singleton but does NOT initialize
ah_refcnt (it remains 0 from static storage initialization)
2. AUTH_DESTROY() calls auth_put() which decrements: 0 - 1 = -1
3. Multiple AUTH_DESTROY() calls lead to: -1, -2, -3, ..., -120, ..

The fix removes all AUTH_DESTROY() calls for nsm_auth since it's a
shared singleton that should persist for the process lifetime.

Change-Id: I45ec10b59e0728bdc387eff555121d208600c885
Signed-off-by: Rajesh Prasad <raprasad@redhat.com>
---
M src/Protocols/NLM/nsm.c
M src/SAL/nlm_owner.c
2 files changed, 17 insertions(+), 3 deletions(-)

git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/34/1238734/1

To view, visit change 1238734. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-Change-Id: I45ec10b59e0728bdc387eff555121d208600c885
Gerrit-Change-Number: 1238734
Gerrit-PatchSet: 1
Gerrit-Owner: Rajesh Prasad <raprasad@redhat.com>