bool MultiLogFiles::logFileNFSError(const char *logFilename, bool nfsIsError) { BOOLEAN isNfs; if ( fs_detect_nfs( logFilename, &isNfs ) != 0 ) { // can't determine if it's on NFS dprintf(D_ALWAYS, "WARNING: can't determine whether log file %s " "is on NFS.\n", logFilename); } else if ( isNfs ) { if ( nfsIsError ) { dprintf(D_ALWAYS, "ERROR: log file %s is on NFS.\n", logFilename); return true; } else { dprintf(D_FULLDEBUG, "WARNING: log file %s is on NFS. This " "could cause log file corruption and is _not_ recommended.\n", logFilename); } } return false; }
int check_sub_file(void* /*pv*/, SubmitHash * sub, _submit_file_role role, const char * pathname, int flags) { if (role == SFR_LOG) { if ( !DumpClassAdToFile && !DashDryRun ) { // check that the log is a valid path if ( !DisableFileChecks ) { FILE* test = safe_fopen_wrapper_follow(pathname, "a+", 0664); if (!test) { fprintf(stderr, "\nERROR: Invalid log file: \"%s\" (%s)\n", pathname, strerror(errno)); return 1; } else { fclose(test); } } // Check that the log file isn't on NFS bool nfs_is_error = param_boolean("LOG_ON_NFS_IS_ERROR", false); bool nfs = false; if ( nfs_is_error ) { if ( fs_detect_nfs( pathname, &nfs ) != 0 ) { fprintf(stderr, "\nWARNING: Can't determine whether log file %s is on NFS\n", pathname ); } else if ( nfs ) { fprintf(stderr, "\nERROR: Log file %s is on NFS.\nThis could cause" " log file corruption. Condor has been configured to" " prohibit log files on NFS.\n", pathname ); return 1; } } } return 0; } else if (role == SFR_EXECUTABLE || role == SFR_PSEUDO_EXECUTABLE) { const char * ename = pathname; bool transfer_it = (flags & 1) != 0; LastExecutable = ename; SpoolLastExecutable = false; // ensure the executables exist and spool them only if no // $$(arch).$$(opsys) are specified (note that if we are simply // dumping the class-ad to a file, we won't actually transfer // or do anything [nothing that follows will affect the ad]) if ( transfer_it && !DumpClassAdToFile && !strstr(ename,"$$") ) { StatInfo si(ename); if ( SINoFile == si.Error () ) { fprintf ( stderr, "\nERROR: Executable file %s does not exist\n", ename ); return 1; // abort } if (!si.Error() && (si.GetFileSize() == 0)) { fprintf( stderr, "\nERROR: Executable file %s has zero length\n", ename ); return 1; // abort } if (role == SFR_EXECUTABLE) { bool param_exists; SpoolLastExecutable = sub->submit_param_bool( SUBMIT_KEY_CopyToSpool, "CopyToSpool", false, ¶m_exists ); if ( ! param_exists) { if ( submit_hash.getUniverse() == CONDOR_UNIVERSE_STANDARD ) { // Standard universe jobs can't restore from a checkpoint // if the executable changes. Therefore, it is deemed // too risky to have copy_to_spool=false by default // for standard universe. SpoolLastExecutable = true; } else { // In so many cases, copy_to_spool=true would just add // needless overhead. Therefore, (as of 6.9.3), the // default is false. SpoolLastExecutable = false; } } } } return 0; } // Queue files for testing access if not already queued int junk; if( flags & O_WRONLY ) { if ( CheckFilesWrite.lookup(pathname,junk) < 0 ) { // this file not found in our list; add it CheckFilesWrite.insert(pathname,junk); } } else { if ( CheckFilesRead.lookup(pathname,junk) < 0 ) { // this file not found in our list; add it CheckFilesRead.insert(pathname,junk); } } return 0; // of the check is ok, nonzero to abort }