--- ../../netmist.c 2014-12-01 15:28:47.000000000 -0600 +++ ./netmist.c 2015-03-29 17:44:15.000000000 -0500 @@ -7185,6 +7185,10 @@ struct stat stbuf; #endif #endif +#if defined(WIN32) + struct _stat stbuf; + time_t ltime; +#endif fprintf(newstdout,"%s Client starting init\n",get_timestamp(&time_string[0])); fflush(newstdout); @@ -7348,15 +7352,46 @@ sprintf(dir_buf,"%s/SM_%s/Dir%d/bucket%d/%s",workdir, work_obj[my_workload].work_obj_name,i,k,"dir_lock"); #endif + +too_old: #if defined(WIN32) ret = GetFileAttributes(dir_buf); if(ret != INVALID_FILE_ATTRIBUTES) { + ret = I_STAT(dir_buf, &stbuf); + time(<ime); + /* In case someone killed the test, or it died, there + might be some very old dir_lock files around. We + need to be sure that none exist for the first proc + to work on the files in this directory. If we don't + clean this up, then the files may not get created, + or set back to their original sizes for the next + load point. If dir_lock is older than 2 minutes, + lets unlink and try again. + */ + if( ltime - stbuf.st_ctime > 120) + { + unlink(dir_buf); + goto too_old; + } #else - ret = I_STAT(dir_buf, &stbuf); if( ret == 0 ) { + /* In case someone killed the test, or it died, there + might be some very old dir_lock files around. We + need to be sure that none exist for the first proc + to work on the files in this directory. If we don't + clean this up, then the files may not get created, + or set back to their original sizes for the next + load point. If dir_lock is older than 2 minutes, + lets unlink and try again. + */ + if(time(0) - stbuf.st_ctime > 120) + { + unlink(dir_buf); + goto too_old; + } #endif locked_dir = 0; /* Percent done */ @@ -9216,7 +9251,7 @@ #else try_large_xfer: ret=read(fd,buf,trans); - if(ret <= 0) + if(ret < 0) { c_eval=errno; if((errno == EINVAL) && (flags & O_DIRECT) && (retry_xfer_count==0) @@ -9238,7 +9273,6 @@ fp->filename,err_str,c_eval, ret); fflush(newstdout); c_eflag++; - free(buf); if(use_cached_fd) { fp->file_desc = 0; @@ -9588,7 +9622,6 @@ err_str,c_eval,ret); fflush(newstdout); c_eflag++; - free(buf); if(use_cached_fd) { fp->file_desc = 0; @@ -11897,6 +11930,7 @@ fp->access_count,alt_name); /* global (across all files in this work object) write count */ work_obj[my_workload].rename_op_count++; + work_obj[my_workload].total_file_ops+=1.0; total_file_ops += 1.0; if(Op_lat_flag) @@ -12539,6 +12573,11 @@ } else { + /* Clean up any left over dir_lock files */ + if(sharing_flag) + { + drain_list(); + } for(i=0;i<10;i++) { if((i==child_listen_socket) || @@ -12603,6 +12642,11 @@ } else { + /* Clean up any left over dir_lock files */ + if(sharing_flag) + { + drain_list(); + } /* Tell the master the cause, if you have one */ if(c_eflag) tell_master_error(client_id,c_eval);