]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix legacy layout decode with pool 0
authorSage Weil <sage@redhat.com>
Tue, 5 Apr 2016 20:37:25 +0000 (16:37 -0400)
committerSage Weil <sage@redhat.com>
Tue, 5 Apr 2016 20:37:25 +0000 (16:37 -0400)
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 <sage@redhat.com>
src/common/fs_types.cc

index 741e4f123310ca295778a1beaeccd54716132cc2..3c7e5e1c905f7731fc68aa9307ee391d5d1ba4de 100644 (file)
@@ -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();
 }