Skip to content

Commit

Permalink
client: make sync_fs() flush dirty data in objectcacher
Browse files Browse the repository at this point in the history
Signed-off-by: Yan, Zheng <zyan@redhat.com>
  • Loading branch information
ukernel committed Oct 28, 2015
1 parent ac0f200 commit 10c7f06
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/client/Client.cc
Expand Up @@ -8625,6 +8625,15 @@ int Client::_sync_fs()
{
ldout(cct, 10) << "_sync_fs" << dendl;

// flush file data
Mutex lock("Client::_fsync::lock");
Cond cond;
bool flush_done = false;
if (cct->_conf->client_oc)
objectcacher->flush_all(new C_SafeCond(&lock, &cond, &flush_done));
else
flush_done = true;

// flush caps
flush_caps();
ceph_tid_t flush_tid = last_flush_tid;
Expand All @@ -8634,8 +8643,15 @@ int Client::_sync_fs()

wait_sync_caps(flush_tid);

// flush file data
// FIXME
if (!flush_done) {
client_lock.Unlock();
lock.Lock();
ldout(cct, 15) << "waiting on data to flush" << dendl;
while (!flush_done)
cond.Wait(lock);
lock.Unlock();
client_lock.Lock();
}

return 0;
}
Expand Down

0 comments on commit 10c7f06

Please sign in to comment.