From: Jianpeng Ma Date: Thu, 3 Mar 2016 13:46:55 +0000 (+0800) Subject: os/bluestore/BlueStore: Don't leak trim overlay data before write. X-Git-Tag: v10.1.0~240^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fcc459c8af4295d75a7e21322b389963e576f76e;p=ceph.git os/bluestore/BlueStore: Don't leak trim overlay data before write. Suppose: bluestore_overlay_max_length=bluestore_min_alloc_size; bluestore_overlay_max = 2; For the following ops: write(off=0, len=4096) --->write into overlay write(off=4096, len=4096)-->write into overlay write(off=0, len=bluestore_min_alloc_size)-->because overlay_map.size() >=2, it allocate a extent. It should trim overlay data(0,4096) &(4096, 4096),and then write(0, bluestore_min_alloc_size). But the original code don't trim overlay data. This make the later read data is orignal data rather that new data. Signed-off-by: Jianpeng Ma --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 96a10f423bdf..c52f3371d510 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -5538,6 +5538,7 @@ int BlueStore::_do_write( uint64_t x_off = offset - bp->first; dout(20) << __func__ << " write " << offset << "~" << length << " x_off " << x_off << dendl; + _do_overlay_trim(txc, o, offset, length); bdev->aio_write(bp->second.offset + x_off, bl, &txc->ioc, buffered); bp->second.clear_flag(bluestore_extent_t::FLAG_UNWRITTEN); bp->second.clear_flag(bluestore_extent_t::FLAG_COW_HEAD);