} /* else "hard" mount - keep retrying until process is killed or server comes back up */ 
} /* else "hard" mount - keep retrying until process is killed or server comes on-line */ 
smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,	 void **request_buf /* returned */ ,	 void **response_buf /* returned */ ){	int rc = 0;	/* SMBs NegProt, SessSetup, uLogoff do not have tcon yet so	   check for tcp and smb session status done differently	   for those three - in the calling routine */	if(tcon) {		if((tcon->ses) && (tcon->ses->server)){			struct nls_table *nls_codepage;				/* Give Demultiplex thread up to 10 seconds to 					reconnect, should be greater than cifs socket					timeout which is 7 seconds */			while(tcon->ses->server->tcpStatus == CifsNeedReconnect) {				wait_event_interruptible_timeout(tcon->ses->server->response_q,					(tcon->ses->server->tcpStatus == CifsGood), 10 * HZ);				if(tcon->ses->server->tcpStatus == CifsNeedReconnect) {					/* on "soft" mounts we wait once */					if((tcon->retry == FALSE) || 					   (tcon->ses->status == CifsExiting)) {						cFYI(1,("gave up waiting on reconnect in smb_init"));						return -EHOSTDOWN;					} /* else "hard" mount - keep retrying until 					process is killed or server comes back up */				} else /* TCP session is reestablished now */					break;				 			}						nls_codepage = load_nls_default();		/* need to prevent multiple threads trying to		simultaneously reconnect the same SMB session */			down(&tcon->ses->sesSem);			if(tcon->ses->status == CifsNeedReconnect)				rc = cifs_setup_session(0, tcon->ses, nls_codepage);			if(!rc && (tcon->tidStatus == CifsNeedReconnect)) {				mark_open_files_invalid(tcon);				rc = CIFSTCon(0, tcon->ses, tcon->treeName, tcon,					nls_codepage);				up(&tcon->ses->sesSem);				if(rc == 0)					atomic_inc(&tconInfoReconnectCount);				cFYI(1, ("reconnect tcon rc = %d", rc));				/* Removed call to reopen open files here - 					it is safer (and faster) to reopen files					one at a time as needed in read and write */				/* Check if handle based operation so we 					know whether we can continue or not without					returning to caller to reset file handle */				switch(smb_command) {					case SMB_COM_READ_ANDX:					case SMB_COM_WRITE_ANDX:					case SMB_COM_CLOSE:					case SMB_COM_FIND_CLOSE2:					case SMB_COM_LOCKING_ANDX: {						unload_nls(nls_codepage);						return -EAGAIN;					}				}			} else {				up(&tcon->ses->sesSem);			}			unload_nls(nls_codepage);		} else {			return -EIO;		}	}	if(rc)		return rc;	*request_buf = cifs_buf_get();	if (*request_buf == NULL) {		/* BB should we add a retry in here if not a writepage? */		return -ENOMEM;	}    /* Although the original thought was we needed the response buf for  */    /* potential retries of smb operations it turns out we can determine */    /* from the mid flags when the request buffer can be resent without  */    /* having to use a second distinct buffer for the response */	*response_buf = *request_buf; 	header_assemble((struct smb_hdr *) *request_buf, smb_command, tcon,			wct /*wct */ );#ifdef CONFIG_CIFS_STATS        if(tcon != NULL) {                atomic_inc(&tcon->num_smbs_sent);        }#endif /* CONFIG_CIFS_STATS */	return rc;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/09d1db5c6131232f764046160c29118cd4e5e646/cifssmb.c/buggy/fs/cifs/cifssmb.c