libceph: fix legacy layout decode with pool 0
authorYan, Zheng <zyan@redhat.com>
Wed, 9 Nov 2016 08:42:48 +0000 (16:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Nov 2016 09:51:52 +0000 (10:51 +0100)
commit18c801047a181620db2336e55e7c300e42f3e549
tree20fccf34be6b1b121adf61c58d22a317a48a30ba
parent53c1792b94daaa131e9ab0ac6e538b0a3f5bbd45
libceph: fix legacy layout decode with pool 0

commit 3890dce1d3a8b9fe3bc36de99496792e468cd079 upstream.

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: 7627151ea30bc ("libceph: define new ceph_file_layout structure")
Link: http://tracker.ceph.com/issues/17825
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ceph/ceph_fs.c