It's possible that we'll have an in-progress call on some of the clients
while a rogue EXCHANGE_ID or DESTROY_CLIENTID call comes in. Be sure to
try and mark the client expired first, so that the refcount is
respected.
This will only be a problem once the client_mutex is removed.
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
 
        /* case 1 (normal case) */
 out_new:
-       if (conf)
-               unhash_client_locked(conf);
+       if (conf) {
+               status = mark_client_expired_locked(conf);
+               if (status)
+                       goto out;
+       }
        new->cl_minorversion = cstate->minorversion;
        new->cl_mach_cred = (exid->spa_how == SP4_MACH_CRED);
 
                        status = nfserr_clientid_busy;
                        goto out;
                }
+               status = mark_client_expired_locked(conf);
+               if (status)
+                       goto out;
                clp = conf;
        } else if (unconf)
                clp = unconf;