ceph: take cap references in write_begin, release them in write_end