提交 474ef7ce 编写于 作者: J Josh Durgin 提交者: Sage Weil

rbd: only reset capacity when pointing to head

Snapshots cannot be resized, and the new capacity of head should not
be reflected by the snapshot.
Signed-off-by: NJosh Durgin <josh.durgin@inktank.com>
Reviewed-by: NAlex Elder <elder@inktank.com>
上级 e88a36ec
......@@ -1725,7 +1725,12 @@ static int __rbd_refresh_header(struct rbd_device *rbd_dev)
return ret;
/* resized? */
set_capacity(rbd_dev->disk, h.image_size / SECTOR_SIZE);
if (rbd_dev->snap_id == CEPH_NOSNAP) {
sector_t size = (sector_t) h.image_size / SECTOR_SIZE;
dout("setting size to %llu sectors", (unsigned long long) size);
set_capacity(rbd_dev->disk, size);
}
down_write(&rbd_dev->header_rwsem);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册