summaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorJosh Durgin <josh.durgin@inktank.com>2011-11-21 17:13:54 -0800
committerSage Weil <sage@inktank.com>2012-07-30 18:15:37 -0700
commit474ef7ce832d471148f63a9d07f67fc5564834f1 (patch)
tree2741be10d318adfde0e044f4c31eb2b94840c2cf /drivers/block
parente88a36ec961b8c1899c59c5e4ae35a318c0209d3 (diff)
downloadlinux-474ef7ce832d471148f63a9d07f67fc5564834f1.tar.bz2
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: Josh Durgin <josh.durgin@inktank.com> Reviewed-by: Alex Elder <elder@inktank.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rbd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 730d0ce505e1..f171cebabda9 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -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);