aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-25 14:46:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-25 14:46:31 -0400
commit57bb55957432f20fd6e5bb5ddfbd9987439157ec (patch)
treede4adeffd13a5394b84f04c6f60582b63685adc9 /drivers/block
parent2a651c7f8d377cf88271374315cbb5fe82eac784 (diff)
parentdb3540522e955c1ebb391f4f5324dff4f20ecd09 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client: (23 commits) ceph: fix cap flush race reentrancy libceph: subscribe to osdmap when cluster is full libceph: handle new osdmap down/state change encoding rbd: handle online resize of underlying rbd image ceph: avoid inode lookup on nfs fh reconnect ceph: use LOOKUPINO to make unconnected nfs fh more reliable rbd: use snprintf for disk->disk_name rbd: cleanup: make kfree match kmalloc rbd: warn on update_snaps failure on notify ceph: check return value for start_request in writepages ceph: remove useless check libceph: add missing breaks in addr_set_port libceph: fix TAG_WAIT case ceph: fix broken comparison in readdir loop libceph: fix osdmap timestamp assignment ceph: fix rare potential cap leak libceph: use snprintf for unknown addrs libceph: use snprintf for formatting object name ceph: use snprintf for dirstat content libceph: fix uninitialized value when no get_authorizer method is set ...
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rbd.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 9712fad82bc6..1278098624e6 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1191,14 +1191,19 @@ static int rbd_req_sync_notify_ack(struct rbd_device *dev,
1191static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data) 1191static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data)
1192{ 1192{
1193 struct rbd_device *dev = (struct rbd_device *)data; 1193 struct rbd_device *dev = (struct rbd_device *)data;
1194 int rc;
1195
1194 if (!dev) 1196 if (!dev)
1195 return; 1197 return;
1196 1198
1197 dout("rbd_watch_cb %s notify_id=%lld opcode=%d\n", dev->obj_md_name, 1199 dout("rbd_watch_cb %s notify_id=%lld opcode=%d\n", dev->obj_md_name,
1198 notify_id, (int)opcode); 1200 notify_id, (int)opcode);
1199 mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); 1201 mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
1200 __rbd_update_snaps(dev); 1202 rc = __rbd_update_snaps(dev);
1201 mutex_unlock(&ctl_mutex); 1203 mutex_unlock(&ctl_mutex);
1204 if (rc)
1205 pr_warning(DRV_NAME "%d got notification but failed to update"
1206 " snaps: %d\n", dev->major, rc);
1202 1207
1203 rbd_req_sync_notify_ack(dev, ver, notify_id, dev->obj_md_name); 1208 rbd_req_sync_notify_ack(dev, ver, notify_id, dev->obj_md_name);
1204} 1209}
@@ -1597,7 +1602,7 @@ static int rbd_header_add_snap(struct rbd_device *dev,
1597 int name_len = strlen(snap_name); 1602 int name_len = strlen(snap_name);
1598 u64 new_snapid; 1603 u64 new_snapid;
1599 int ret; 1604 int ret;
1600 void *data, *data_start, *data_end; 1605 void *data, *p, *e;
1601 u64 ver; 1606 u64 ver;
1602 1607
1603 /* we should create a snapshot only if we're pointing at the head */ 1608 /* we should create a snapshot only if we're pointing at the head */
@@ -1614,16 +1619,16 @@ static int rbd_header_add_snap(struct rbd_device *dev,
1614 if (!data) 1619 if (!data)
1615 return -ENOMEM; 1620 return -ENOMEM;
1616 1621
1617 data_start = data; 1622 p = data;
1618 data_end = data + name_len + 16; 1623 e = data + name_len + 16;
1619 1624
1620 ceph_encode_string_safe(&data, data_end, snap_name, name_len, bad); 1625 ceph_encode_string_safe(&p, e, snap_name, name_len, bad);
1621 ceph_encode_64_safe(&data, data_end, new_snapid, bad); 1626 ceph_encode_64_safe(&p, e, new_snapid, bad);
1622 1627
1623 ret = rbd_req_sync_exec(dev, dev->obj_md_name, "rbd", "snap_add", 1628 ret = rbd_req_sync_exec(dev, dev->obj_md_name, "rbd", "snap_add",
1624 data_start, data - data_start, &ver); 1629 data, p - data, &ver);
1625 1630
1626 kfree(data_start); 1631 kfree(data);
1627 1632
1628 if (ret < 0) 1633 if (ret < 0)
1629 return ret; 1634 return ret;
@@ -1659,6 +1664,9 @@ static int __rbd_update_snaps(struct rbd_device *rbd_dev)
1659 if (ret < 0) 1664 if (ret < 0)
1660 return ret; 1665 return ret;
1661 1666
1667 /* resized? */
1668 set_capacity(rbd_dev->disk, h.image_size / 512ULL);
1669
1662 down_write(&rbd_dev->header.snap_rwsem); 1670 down_write(&rbd_dev->header.snap_rwsem);
1663 1671
1664 snap_seq = rbd_dev->header.snapc->seq; 1672 snap_seq = rbd_dev->header.snapc->seq;
@@ -1716,7 +1724,8 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
1716 if (!disk) 1724 if (!disk)
1717 goto out; 1725 goto out;
1718 1726
1719 sprintf(disk->disk_name, DRV_NAME "%d", rbd_dev->id); 1727 snprintf(disk->disk_name, sizeof(disk->disk_name), DRV_NAME "%d",
1728 rbd_dev->id);
1720 disk->major = rbd_dev->major; 1729 disk->major = rbd_dev->major;
1721 disk->first_minor = 0; 1730 disk->first_minor = 0;
1722 disk->fops = &rbd_bd_ops; 1731 disk->fops = &rbd_bd_ops;