Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 320340
b: refs/heads/master
c: a51aa0c
h: refs/heads/master
v: v3
  • Loading branch information
Josh Durgin authored and Sage Weil committed Jul 31, 2012
1 parent f207938 commit fa2c31c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 474ef7ce832d471148f63a9d07f67fc5564834f1
refs/heads/master: a51aa0c042fa39946dd017d5f91a073300a71577
11 changes: 8 additions & 3 deletions trunk/drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1724,6 +1724,8 @@ static int __rbd_refresh_header(struct rbd_device *rbd_dev)
if (ret < 0)
return ret;

down_write(&rbd_dev->header_rwsem);

/* resized? */
if (rbd_dev->snap_id == CEPH_NOSNAP) {
sector_t size = (sector_t) h.image_size / SECTOR_SIZE;
Expand All @@ -1732,8 +1734,6 @@ static int __rbd_refresh_header(struct rbd_device *rbd_dev)
set_capacity(rbd_dev->disk, size);
}

down_write(&rbd_dev->header_rwsem);

snap_seq = rbd_dev->header.snapc->seq;
if (rbd_dev->header.total_snaps &&
rbd_dev->header.snapc->snaps[0] == snap_seq)
Expand Down Expand Up @@ -1853,8 +1853,13 @@ static ssize_t rbd_size_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
sector_t size;

down_read(&rbd_dev->header_rwsem);
size = get_capacity(rbd_dev->disk);
up_read(&rbd_dev->header_rwsem);

return sprintf(buf, "%llu\n", (unsigned long long)rbd_dev->header.image_size);
return sprintf(buf, "%llu\n", (unsigned long long) size * SECTOR_SIZE);
}

static ssize_t rbd_major_show(struct device *dev,
Expand Down

0 comments on commit fa2c31c

Please sign in to comment.