libceph: eliminate overflows in ceph_calc_file_object_mapping()
authorIlya Dryomov <idryomov@gmail.com>
Tue, 16 Jan 2018 11:15:02 +0000 (12:15 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 2 Apr 2018 08:12:38 +0000 (10:12 +0200)
commitdb2196a58939c0b75b9b7ea5ab1fec4081d48661
tree55b84f92cd7c50aabe163160433c730db83e3160
parent24f1df60ce943aee107b3cb99b37a0152c9dd47a
libceph: eliminate overflows in ceph_calc_file_object_mapping()

bl, stripeno and objsetno should be u64 -- otherwise large enough files
get corrupted.  How large depends on file layout:

- 4M-objects layout (default): any file over 16P
- 64K-objects layout (smallest possible object size): any file over 512T

Only CephFS is affected, rbd doesn't use ceph_calc_file_object_mapping()
yet.  Fortunately, CephFS has a max_file_size configurable, the default
for which is way below both of the above numbers.

Reimplement the logic from scratch with no layout validation -- it's
done on the MDS side.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
net/ceph/osdmap.c