Commit a71b891b authored by Josh Durgin's avatar Josh Durgin Committed by Sage Weil

rbd: send header version when notifying

Previously the original header version was sent. Now, we update it
when the header changes.
Signed-off-by: default avatarJosh Durgin <josh.durgin@dreamhost.com>
Reviewed-by: default avatarAlex Elder <elder@inktank.com>
parent d1d25646
...@@ -1197,7 +1197,7 @@ static int rbd_req_sync_notify_ack(struct rbd_device *rbd_dev, ...@@ -1197,7 +1197,7 @@ static int rbd_req_sync_notify_ack(struct rbd_device *rbd_dev,
if (ret < 0) if (ret < 0)
return ret; return ret;
ops[0].watch.ver = cpu_to_le64(rbd_dev->header.obj_version); ops[0].watch.ver = cpu_to_le64(ver);
ops[0].watch.cookie = notify_id; ops[0].watch.cookie = notify_id;
ops[0].watch.flag = 0; ops[0].watch.flag = 0;
...@@ -1216,6 +1216,7 @@ static int rbd_req_sync_notify_ack(struct rbd_device *rbd_dev, ...@@ -1216,6 +1216,7 @@ static int rbd_req_sync_notify_ack(struct rbd_device *rbd_dev,
static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data) static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data)
{ {
struct rbd_device *rbd_dev = (struct rbd_device *)data; struct rbd_device *rbd_dev = (struct rbd_device *)data;
u64 hver;
int rc; int rc;
if (!rbd_dev) if (!rbd_dev)
...@@ -1225,12 +1226,13 @@ static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data) ...@@ -1225,12 +1226,13 @@ static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data)
rbd_dev->header_name, notify_id, (int) opcode); rbd_dev->header_name, notify_id, (int) opcode);
mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
rc = __rbd_refresh_header(rbd_dev); rc = __rbd_refresh_header(rbd_dev);
hver = rbd_dev->header.obj_version;
mutex_unlock(&ctl_mutex); mutex_unlock(&ctl_mutex);
if (rc) if (rc)
pr_warning(RBD_DRV_NAME "%d got notification but failed to " pr_warning(RBD_DRV_NAME "%d got notification but failed to "
" update snaps: %d\n", rbd_dev->major, rc); " update snaps: %d\n", rbd_dev->major, rc);
rbd_req_sync_notify_ack(rbd_dev, ver, notify_id, rbd_dev->header_name); rbd_req_sync_notify_ack(rbd_dev, hver, notify_id, rbd_dev->header_name);
} }
/* /*
...@@ -1746,6 +1748,7 @@ static int __rbd_refresh_header(struct rbd_device *rbd_dev) ...@@ -1746,6 +1748,7 @@ static int __rbd_refresh_header(struct rbd_device *rbd_dev)
/* osd requests may still refer to snapc */ /* osd requests may still refer to snapc */
ceph_put_snap_context(rbd_dev->header.snapc); ceph_put_snap_context(rbd_dev->header.snapc);
rbd_dev->header.obj_version = h.obj_version;
rbd_dev->header.image_size = h.image_size; rbd_dev->header.image_size = h.image_size;
rbd_dev->header.total_snaps = h.total_snaps; rbd_dev->header.total_snaps = h.total_snaps;
rbd_dev->header.snapc = h.snapc; rbd_dev->header.snapc = h.snapc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment