aboutsummaryrefslogtreecommitdiff
path: root/drivers/block/rbd.c
diff options
context:
space:
mode:
authorJosh Durgin <josh.durgin@dreamhost.com>2011-12-05 18:10:44 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-17 08:51:18 -0800
commitca9a5e33a97a965378a2a0387fd8acf3a0144950 (patch)
tree016bd826934dc806e785043201bc63285668a276 /drivers/block/rbd.c
parentfc5eb627a897ac41581692abf60ffea874df2e55 (diff)
rbd: send header version when notifying
Previously the original header version was sent. Now, we update it when the header changes. Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com> Reviewed-by: Alex Elder <elder@inktank.com> (cherry picked from commit a71b891bc7d77a070e723c8c53d1dd73cf931555) Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r--drivers/block/rbd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index dc26c2e48d8..52e295defb9 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1195,7 +1195,7 @@ static int rbd_req_sync_notify_ack(struct rbd_device *dev,
if (ret < 0)
return ret;
- ops[0].watch.ver = cpu_to_le64(dev->header.obj_version);
+ ops[0].watch.ver = cpu_to_le64(ver);
ops[0].watch.cookie = notify_id;
ops[0].watch.flag = 0;
@@ -1215,6 +1215,7 @@ static int rbd_req_sync_notify_ack(struct rbd_device *dev,
static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data)
{
struct rbd_device *dev = (struct rbd_device *)data;
+ u64 hver;
int rc;
if (!dev)
@@ -1224,12 +1225,13 @@ static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data)
notify_id, (int)opcode);
mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
rc = __rbd_update_snaps(dev);
+ hver = dev->header.obj_version;
mutex_unlock(&ctl_mutex);
if (rc)
pr_warning(RBD_DRV_NAME "%d got notification but failed to "
" update snaps: %d\n", dev->major, rc);
- rbd_req_sync_notify_ack(dev, ver, notify_id, dev->obj_md_name);
+ rbd_req_sync_notify_ack(dev, hver, notify_id, dev->obj_md_name);
}
/*
@@ -1740,6 +1742,7 @@ static int __rbd_update_snaps(struct rbd_device *rbd_dev)
kfree(rbd_dev->header.snap_names);
kfree(rbd_dev->header.snap_sizes);
+ rbd_dev->header.obj_version = h.obj_version;
rbd_dev->header.image_size = h.image_size;
rbd_dev->header.total_snaps = h.total_snaps;
rbd_dev->header.snapc = h.snapc;