Commit 3890dce1 authored by Yan, Zheng's avatar Yan, Zheng Committed by Ilya Dryomov

libceph: fix legacy layout decode with pool 0

If your data pool was pool 0, ceph_file_layout_from_legacy()
transform that to -1 unconditionally, which broke upgrades.
We only want do that for a fully zeroed ceph_file_layout,
so that it still maps to a file_layout_t.  If any fields
are set, though, we trust the fl_pgpool to be a valid pool.

Fixes: 7627151e ("libceph: define new ceph_file_layout structure")
Link: http://tracker.ceph.com/issues/17825Signed-off-by: default avatarYan, Zheng <zyan@redhat.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 8a8d5617
...@@ -34,7 +34,8 @@ void ceph_file_layout_from_legacy(struct ceph_file_layout *fl, ...@@ -34,7 +34,8 @@ void ceph_file_layout_from_legacy(struct ceph_file_layout *fl,
fl->stripe_count = le32_to_cpu(legacy->fl_stripe_count); fl->stripe_count = le32_to_cpu(legacy->fl_stripe_count);
fl->object_size = le32_to_cpu(legacy->fl_object_size); fl->object_size = le32_to_cpu(legacy->fl_object_size);
fl->pool_id = le32_to_cpu(legacy->fl_pg_pool); fl->pool_id = le32_to_cpu(legacy->fl_pg_pool);
if (fl->pool_id == 0) if (fl->pool_id == 0 && fl->stripe_unit == 0 &&
fl->stripe_count == 0 && fl->object_size == 0)
fl->pool_id = -1; fl->pool_id = -1;
} }
EXPORT_SYMBOL(ceph_file_layout_from_legacy); EXPORT_SYMBOL(ceph_file_layout_from_legacy);
......
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