Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pfc: Handle client disconnect at the startup time #477

Merged
merged 1 commit into from
Mar 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
67 changes: 33 additions & 34 deletions src/XrdFileCache/XrdFileCacheFile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,47 +135,46 @@ bool File::ioActive()
// Retruns true if delay is needed

TRACEF(Debug, "File::ioActive start");

if (! m_is_open) return false;


// remove failed blocks and check if map is empty
m_downloadCond.Lock();

if (m_prefetchState != kStopped)
bool blockMapEmpty = false;
{
m_prefetchState = kStopped;
cache()->DeRegisterPrefetchFile(this);
}


// High debug print
// for (BlockMap_i it = m_block_map.begin(); it != m_block_map.end(); ++it)
// {
// Block* b = it->second;
// TRACEF(Dump, "File::ioActive block idx = " << b->m_offset/m_cfi.GetBufferSize() << " prefetch = " << b->prefetch << " refcnt " << b->refcnt);
// }
TRACEF(Info, "ioActive block_map.size() = " << m_block_map.size());
XrdSysCondVarHelper _lck(m_downloadCond);
if (! m_is_open) return false;

BlockMap_i itr = m_block_map.begin();
while (itr != m_block_map.end())
{
if (itr->second->is_failed() && itr->second->m_refcnt == 1)
if (m_prefetchState != kStopped)
{
BlockMap_i toErase = itr;
++itr;
TRACEF(Debug, "Remove failed block " << itr->second->m_offset/m_cfi.GetBufferSize());
free_block(toErase->second);
m_prefetchState = kStopped;
cache()->DeRegisterPrefetchFile(this);
}
else


// High debug print
// for (BlockMap_i it = m_block_map.begin(); it != m_block_map.end(); ++it)
// {
// Block* b = it->second;
// TRACEF(Dump, "File::ioActive block idx = " << b->m_offset/m_cfi.GetBufferSize() << " prefetch = " << b->prefetch << " refcnt " << b->refcnt);
// }
TRACEF(Info, "ioActive block_map.size() = " << m_block_map.size());

// remove failed blocks and check if map is empty
BlockMap_i itr = m_block_map.begin();
while (itr != m_block_map.end())
{
++itr;
if (itr->second->is_failed() && itr->second->m_refcnt == 1)
{
BlockMap_i toErase = itr;
++itr;
TRACEF(Debug, "Remove failed block " << itr->second->m_offset/m_cfi.GetBufferSize());
free_block(toErase->second);
}
else
{
++itr;
}
}
}

bool blockMapEmpty = m_block_map.empty();
m_downloadCond.UnLock();

blockMapEmpty = m_block_map.empty();
}

if (blockMapEmpty)
{
// file is not active when block map is empty and sync is done
Expand Down