diff options
author | Yan, Zheng <zyan@redhat.com> | 2016-06-13 07:05:13 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2016-07-27 20:55:37 -0400 |
commit | cd08e0a274ba6215b79c83809b331e8af17196ba (patch) | |
tree | 47f2224fe1be44a30239b4a355eb262373919ab5 /net | |
parent | 30c156d9951e0aa88202707d80c583b0a09d3167 (diff) |
libceph: make sure redirect does not change namespace
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/ceph/osd_client.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index b68cc15e9cdc..b5ec09612ff7 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -2608,10 +2608,23 @@ static int ceph_oloc_decode(void **p, void *end, | |||
2608 | } | 2608 | } |
2609 | 2609 | ||
2610 | if (struct_v >= 5) { | 2610 | if (struct_v >= 5) { |
2611 | bool changed = false; | ||
2612 | |||
2611 | len = ceph_decode_32(p); | 2613 | len = ceph_decode_32(p); |
2612 | if (len > 0) { | 2614 | if (len > 0) { |
2613 | ceph_decode_need(p, end, len, e_inval); | 2615 | ceph_decode_need(p, end, len, e_inval); |
2616 | if (!oloc->pool_ns || | ||
2617 | ceph_compare_string(oloc->pool_ns, *p, len)) | ||
2618 | changed = true; | ||
2614 | *p += len; | 2619 | *p += len; |
2620 | } else { | ||
2621 | if (oloc->pool_ns) | ||
2622 | changed = true; | ||
2623 | } | ||
2624 | if (changed) { | ||
2625 | /* redirect changes namespace */ | ||
2626 | pr_warn("ceph_object_locator::nspace is changed\n"); | ||
2627 | goto e_inval; | ||
2615 | } | 2628 | } |
2616 | } | 2629 | } |
2617 | 2630 | ||
@@ -2820,7 +2833,9 @@ static void handle_reply(struct ceph_osd *osd, struct ceph_msg *msg) | |||
2820 | goto out_unlock_session; | 2833 | goto out_unlock_session; |
2821 | } | 2834 | } |
2822 | 2835 | ||
2836 | m.redirect.oloc.pool_ns = req->r_t.target_oloc.pool_ns; | ||
2823 | ret = decode_MOSDOpReply(msg, &m); | 2837 | ret = decode_MOSDOpReply(msg, &m); |
2838 | m.redirect.oloc.pool_ns = NULL; | ||
2824 | if (ret) { | 2839 | if (ret) { |
2825 | pr_err("failed to decode MOSDOpReply for tid %llu: %d\n", | 2840 | pr_err("failed to decode MOSDOpReply for tid %llu: %d\n", |
2826 | req->r_tid, ret); | 2841 | req->r_tid, ret); |