Skip to content

Commit

Permalink
Check file is opened in FinalizeSyncBeforeExit.
Browse files Browse the repository at this point in the history
  • Loading branch information
alja committed Jun 27, 2017
1 parent 5e04082 commit ce57c1b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/XrdFileCache/XrdFileCacheFile.cc
Expand Up @@ -167,15 +167,16 @@ bool File::FinalizeSyncBeforeExit()
// This method is called after corresponding IO is detached from PosixCache.

XrdSysCondVarHelper _lck(m_downloadCond);

if ( ! m_writes_during_sync.empty() || m_non_flushed_cnt > 0 || ! m_detachTimeIsLogged)
if ( m_is_open )
{
m_cfi.WriteIOStatDetach(m_stats);
m_detachTimeIsLogged = true;
TRACEF(Debug, "File::FinalizeSyncBeforeExit scheduling sync to write detach stats");
return true;
if ( ! m_writes_during_sync.empty() || m_non_flushed_cnt > 0 || ! m_detachTimeIsLogged)
{
m_cfi.WriteIOStatDetach(m_stats);
m_detachTimeIsLogged = true;
TRACEF(Debug, "File::FinalizeSyncBeforeExit scheduling sync to write detach stats");
return true;
}
}

TRACEF(Debug, "File::FinalizeSyncBeforeExit sync not required");
return false;
}
Expand Down Expand Up @@ -234,7 +235,7 @@ bool File::Open()
<< ", err=" << strerror(errno));
return false;
}

m_output = myOss.newFile(myUser);
if (m_output->Open(m_filename.c_str(), O_RDWR, 0600, myEnv) != XrdOssOK)
{
Expand Down

0 comments on commit ce57c1b

Please sign in to comment.