diff options
author | Josh Durgin <josh.durgin@dreamhost.com> | 2011-12-05 21:10:44 -0500 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-07-30 21:15:40 -0400 |
commit | a71b891bc7d77a070e723c8c53d1dd73cf931555 (patch) | |
tree | d5abf327bcf26a8fcc2a9fd41d846c87ad141030 /drivers/block | |
parent | d1d25646543134d756a02ffe4e02073faa761f2c (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>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/rbd.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 988f94458f95..4d3a1e02130b 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -1197,7 +1197,7 @@ static int rbd_req_sync_notify_ack(struct rbd_device *rbd_dev, | |||
1197 | if (ret < 0) | 1197 | if (ret < 0) |
1198 | return ret; | 1198 | return ret; |
1199 | 1199 | ||
1200 | ops[0].watch.ver = cpu_to_le64(rbd_dev->header.obj_version); | 1200 | ops[0].watch.ver = cpu_to_le64(ver); |
1201 | ops[0].watch.cookie = notify_id; | 1201 | ops[0].watch.cookie = notify_id; |
1202 | ops[0].watch.flag = 0; | 1202 | ops[0].watch.flag = 0; |
1203 | 1203 | ||
@@ -1216,6 +1216,7 @@ static int rbd_req_sync_notify_ack(struct rbd_device *rbd_dev, | |||
1216 | static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data) | 1216 | static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data) |
1217 | { | 1217 | { |
1218 | struct rbd_device *rbd_dev = (struct rbd_device *)data; | 1218 | struct rbd_device *rbd_dev = (struct rbd_device *)data; |
1219 | u64 hver; | ||
1219 | int rc; | 1220 | int rc; |
1220 | 1221 | ||
1221 | if (!rbd_dev) | 1222 | if (!rbd_dev) |
@@ -1225,12 +1226,13 @@ static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data) | |||
1225 | rbd_dev->header_name, notify_id, (int) opcode); | 1226 | rbd_dev->header_name, notify_id, (int) opcode); |
1226 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | 1227 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); |
1227 | rc = __rbd_refresh_header(rbd_dev); | 1228 | rc = __rbd_refresh_header(rbd_dev); |
1229 | hver = rbd_dev->header.obj_version; | ||
1228 | mutex_unlock(&ctl_mutex); | 1230 | mutex_unlock(&ctl_mutex); |
1229 | if (rc) | 1231 | if (rc) |
1230 | pr_warning(RBD_DRV_NAME "%d got notification but failed to " | 1232 | pr_warning(RBD_DRV_NAME "%d got notification but failed to " |
1231 | " update snaps: %d\n", rbd_dev->major, rc); | 1233 | " update snaps: %d\n", rbd_dev->major, rc); |
1232 | 1234 | ||
1233 | rbd_req_sync_notify_ack(rbd_dev, ver, notify_id, rbd_dev->header_name); | 1235 | rbd_req_sync_notify_ack(rbd_dev, hver, notify_id, rbd_dev->header_name); |
1234 | } | 1236 | } |
1235 | 1237 | ||
1236 | /* | 1238 | /* |
@@ -1746,6 +1748,7 @@ static int __rbd_refresh_header(struct rbd_device *rbd_dev) | |||
1746 | /* osd requests may still refer to snapc */ | 1748 | /* osd requests may still refer to snapc */ |
1747 | ceph_put_snap_context(rbd_dev->header.snapc); | 1749 | ceph_put_snap_context(rbd_dev->header.snapc); |
1748 | 1750 | ||
1751 | rbd_dev->header.obj_version = h.obj_version; | ||
1749 | rbd_dev->header.image_size = h.image_size; | 1752 | rbd_dev->header.image_size = h.image_size; |
1750 | rbd_dev->header.total_snaps = h.total_snaps; | 1753 | rbd_dev->header.total_snaps = h.total_snaps; |
1751 | rbd_dev->header.snapc = h.snapc; | 1754 | rbd_dev->header.snapc = h.snapc; |