If we race with e.g. truncate and are in bh_write_commit but the oset
is already clean, we should not call the flush callback (again).
This is reproduced by:
- kludging slow osd replies into the code (e.g., 2 second delay)
- mount ceph-fuse with --client-oc-max-dirty-age 1
- dd if=/dev/zero of=mnt/foo count=1
sleep 1
truncate --size 0 mnt/foo
-> crash
Signed-off-by: Sage Weil <sage@inktank.com>
ldout(cct, 7) << "bh_write_commit no object cache" << dendl;
} else {
Object *ob = objects[poolid][oid];
+ int was_dirty_or_tx = ob->oset->dirty_or_tx;
// apply to bh's!
for (map<loff_t, BufferHead*>::iterator p = ob->data.lower_bound(start);
// is the entire object set now clean?
if (flush_set_callback &&
+ was_dirty_or_tx > 0 &&
oset->dirty_or_tx == 0) { // nothing dirty/tx
flush_set_callback(flush_set_callback_arg, oset);
}