diff options
author | Josh Durgin <josh.durgin@inktank.com> | 2011-11-21 17:13:54 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-17 08:51:18 -0800 |
commit | 7272b7d3db9160716acce4ae387cf98fd24ff820 (patch) | |
tree | 99cc7c5c8493cfdc0415039a69c48d2c051b846a /drivers | |
parent | 95268c46ace4492b924abf6e82c6974c152bee29 (diff) |
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>
(cherry picked from commit 474ef7ce832d471148f63a9d07f67fc5564834f1)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/rbd.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 4f7ed7fa549..52a045b11d4 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1721,7 +1721,12 @@ static int __rbd_update_snaps(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); |