diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2017-06-05 14:44:59 +0200 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2017-07-07 17:25:14 +0200 |
commit | ca35ffea898d2cae67820202bd9a494742726b41 (patch) | |
tree | 58a66342211f6d1e27054f348a150064838353aa /net/ceph | |
parent | f179d3ba8cb9073c2d96315b79ff7bc658a1feee (diff) | |
download | op-kernel-dev-ca35ffea898d2cae67820202bd9a494742726b41.zip op-kernel-dev-ca35ffea898d2cae67820202bd9a494742726b41.tar.gz |
libceph: handle non-empty dest in ceph_{oloc,oid}_copy()
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'net/ceph')
-rw-r--r-- | net/ceph/osdmap.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index 55e3a47..bf2fcc83 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c @@ -1547,12 +1547,13 @@ bad: void ceph_oloc_copy(struct ceph_object_locator *dest, const struct ceph_object_locator *src) { - WARN_ON(!ceph_oloc_empty(dest)); - WARN_ON(dest->pool_ns); /* empty() only covers ->pool */ + ceph_oloc_destroy(dest); dest->pool = src->pool; if (src->pool_ns) dest->pool_ns = ceph_get_string(src->pool_ns); + else + dest->pool_ns = NULL; } EXPORT_SYMBOL(ceph_oloc_copy); @@ -1565,14 +1566,15 @@ EXPORT_SYMBOL(ceph_oloc_destroy); void ceph_oid_copy(struct ceph_object_id *dest, const struct ceph_object_id *src) { - WARN_ON(!ceph_oid_empty(dest)); + ceph_oid_destroy(dest); if (src->name != src->inline_name) { /* very rare, see ceph_object_id definition */ dest->name = kmalloc(src->name_len + 1, GFP_NOIO | __GFP_NOFAIL); + } else { + dest->name = dest->inline_name; } - memcpy(dest->name, src->name, src->name_len + 1); dest->name_len = src->name_len; } |