list_for_each_entry(clp, &conf_str_hashtbl[strhashval], cl_strhash) { if (!same_name(clp->cl_recdir, dname)) continue; 
conf = find_confirmed_client_by_str(dname, strhashval); if (conf) { 
nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid){	u32 			ip_addr = rqstp->rq_addr.sin_addr.s_addr;	struct xdr_netobj 	clname = { 		.len = setclid->se_namelen,		.data = setclid->se_name,	};	nfs4_verifier		clverifier = setclid->se_verf;	unsigned int 		strhashval;	struct nfs4_client *	conf, * unconf, * new, * clp;	int 			status;	char                    dname[HEXDIR_LEN];		status = nfserr_inval;	if (!check_name(clname))		goto out;	status = nfs4_make_rec_clidname(dname, &clname);	if (status)		goto out;	/* 	 * XXX The Duplicate Request Cache (DRC) has been checked (??)	 * We get here on a DRC miss.	 */	strhashval = clientstr_hashval(dname);	conf = NULL;	nfs4_lock_state();	list_for_each_entry(clp, &conf_str_hashtbl[strhashval], cl_strhash) {		if (!same_name(clp->cl_recdir, dname))			continue;		/* 		 * CASE 0:		 * clname match, confirmed, different principal		 * or different ip_address		 */		status = nfserr_clid_inuse;		if (!cmp_creds(&clp->cl_cred,&rqstp->rq_cred)				|| clp->cl_addr != ip_addr) {			printk("NFSD: setclientid: string in use by client"			"(clientid %08x/%08x)\n",			clp->cl_clientid.cl_boot, clp->cl_clientid.cl_id);			goto out;		}		conf = clp;		break;	}	unconf = NULL;	list_for_each_entry(clp, &unconf_str_hashtbl[strhashval], cl_strhash) {		if (!same_name(clp->cl_recdir, dname))			continue;		/* cl_name match from a previous SETCLIENTID operation */		unconf = clp;		break;	}	status = nfserr_resource;	if (!conf) {		/* 		 * CASE 4:		 * placed first, because it is the normal case.		 */		if (unconf)			expire_client(unconf);		new = create_client(clname, dname);		if (new == NULL)			goto out;		copy_verf(new, &clverifier);		new->cl_addr = ip_addr;		copy_cred(&new->cl_cred,&rqstp->rq_cred);		gen_clid(new);		gen_confirm(new);		gen_callback(new, setclid);		add_to_unconfirmed(new, strhashval);	} else if (cmp_verf(&conf->cl_verifier, &clverifier)) {		/*		 * CASE 1:		 * cl_name match, confirmed, principal match		 * verifier match: probable callback update		 *		 * remove any unconfirmed nfs4_client with 		 * matching cl_name, cl_verifier, and cl_clientid		 *		 * create and insert an unconfirmed nfs4_client with same 		 * cl_name, cl_verifier, and cl_clientid as existing 		 * nfs4_client,  but with the new callback info and a 		 * new cl_confirm		 */		if ((unconf) && 		    cmp_verf(&unconf->cl_verifier, &conf->cl_verifier) &&		     cmp_clid(&unconf->cl_clientid, &conf->cl_clientid)) {				expire_client(unconf);		}		new = create_client(clname, dname);		if (new == NULL)			goto out;		copy_verf(new,&conf->cl_verifier);		new->cl_addr = ip_addr;		copy_cred(&new->cl_cred,&rqstp->rq_cred);		copy_clid(new, conf);		gen_confirm(new);		gen_callback(new, setclid);		add_to_unconfirmed(new,strhashval);	} else if (!unconf) {		/*		 * CASE 2:		 * clname match, confirmed, principal match		 * verfier does not match		 * no unconfirmed. create a new unconfirmed nfs4_client		 * using input clverifier, clname, and callback info		 * and generate a new cl_clientid and cl_confirm.		 */		new = create_client(clname, dname);		if (new == NULL)			goto out;		copy_verf(new,&clverifier);		new->cl_addr = ip_addr;		copy_cred(&new->cl_cred,&rqstp->rq_cred);		gen_clid(new);		gen_confirm(new);		gen_callback(new, setclid);		add_to_unconfirmed(new, strhashval);	} else if (!cmp_verf(&conf->cl_confirm, &unconf->cl_confirm)) {		/*			 * CASE3:		 * confirmed found (name, principal match)		 * confirmed verifier does not match input clverifier		 *		 * unconfirmed found (name match)		 * confirmed->cl_confirm != unconfirmed->cl_confirm		 *		 * remove unconfirmed.		 *		 * create an unconfirmed nfs4_client 		 * with same cl_name as existing confirmed nfs4_client, 		 * but with new callback info, new cl_clientid,		 * new cl_verifier and a new cl_confirm		 */		expire_client(unconf);		new = create_client(clname, dname);		if (new == NULL)			goto out;		copy_verf(new,&clverifier);		new->cl_addr = ip_addr;		copy_cred(&new->cl_cred,&rqstp->rq_cred);		gen_clid(new);		gen_confirm(new);		gen_callback(new, setclid);		add_to_unconfirmed(new, strhashval);	} else {		/* No cases hit !!! */		status = nfserr_inval;		goto out;	}	setclid->se_clientid.cl_boot = new->cl_clientid.cl_boot;	setclid->se_clientid.cl_id = new->cl_clientid.cl_id;	memcpy(setclid->se_confirm.data, new->cl_confirm.data, sizeof(setclid->se_confirm.data));	status = nfs_ok;out:	nfs4_unlock_state();	return status;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/28ce6054f1de89834e5e9522f9e451cd88a35f85/nfs4state.c/buggy/fs/nfsd/nfs4state.c