Bug #8955

Updated by Marcel Telka over 3 years ago

We found that after a good while, fcntl locking over NFS would return 'no locks available' and noticed all reserved ports were bound on the server. 
 We traced this down to leaked entries in connection manager list maintained in clnt_cots.c (struct cm_xprt *cm_hd). 
 We reproduced with this scenario: 

 1. Linux    DEBIAN7.4 client acquires and releases lock on file on server (via NFS). 
 2. reboot Linux client (but do so _before_ MIR_CLNT_IDLE_TIMEOUT interval fires on server side). 
 3. when Linux client comes back up, repeat step 1. 

 At this point, a cm_entry with only the ORDREL flag set in x_state_flags x_state_word will remain in the cm_entry linked list (cm_hd). 
 It appears that without at least a DEAD flag set in x_state_flags, x_state_word, this cm_entry will remain bound to a the port...and will never be garbage collected. 

 We found two locations to add "cm_entry->x_dead = TRUE;" in clnt_cots.c which allowed these entries to be cleaned up and bound/reserved ports released. 

 (This was discovered about 3 years ago. In a recent discussion on illumos-zfs, this issue appears to have bitten again so we'd like to offer a fix )