From: Sage Weil Date: Tue, 5 Apr 2016 20:37:25 +0000 (-0400) Subject: mds: fix legacy layout decode with pool 0 X-Git-Tag: v10.1.2~50^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cd41ca2968d07d32b5432aa137e2077ef0ffff17;p=ceph.git mds: fix legacy layout decode with pool 0 If you data pool was pool 0, this was transforming 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. Signed-off-by: Sage Weil --- diff --git a/src/common/fs_types.cc b/src/common/fs_types.cc index 741e4f123310..3c7e5e1c905f 100644 --- a/src/common/fs_types.cc +++ b/src/common/fs_types.cc @@ -46,8 +46,9 @@ void file_layout_t::from_legacy(const ceph_file_layout& fl) stripe_count = fl.fl_stripe_count; object_size = fl.fl_object_size; pool_id = (int32_t)fl.fl_pg_pool; - // in the legacy encoding, pool 0 was undefined. - if (pool_id == 0) + // in the legacy encoding, a zeroed structure was the default and + // would have pool 0 instead of -1. + if (pool_id == 0 && stripe_unit == 0 && stripe_count == 0 && object_size == 0) pool_id = -1; pool_ns.clear(); }