Previously we used a check for if there were CEPH_CAP_FILE_BUFFER refs,
but that was racy if we had other threads (they could hold caps for
sync writes or something). Instead, see if we have any in-flight
writes or uncommitted objects.
Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
{
dout(10) << "_flush " << *in << dendl;
- if (in->cap_refs[CEPH_CAP_FILE_BUFFER] == 0) {
+ if (!in->oset.dirty_tx && in->oset.uncommitted.empty()) {
dout(10) << " nothing to flush" << dendl;
return true;
}
if (g_conf.client_oc && (got & CEPH_CAP_FILE_BUFFER)) {
// do buffered write
- if (in->cap_refs[CEPH_CAP_FILE_BUFFER] == 0)
+ if (!in->oset.dirty_tx && in->oset.uncommitted.empty())
get_cap_ref(in, CEPH_CAP_FILE_BUFFER);
get_cap_ref(in, CEPH_CAP_FILE_BUFFER);