linux/fs/ceph
Jeff Layton ebce3eb2f7 ceph: fix inode number handling on arches with 32-bit ino_t
Tuan and Ulrich mentioned that they were hitting a problem on s390x,
which has a 32-bit ino_t value, even though it's a 64-bit arch (for
historical reasons).

I think the current handling of inode numbers in the ceph driver is
wrong. It tries to use 32-bit inode numbers on 32-bit arches, but that's
actually not a problem. 32-bit arches can deal with 64-bit inode numbers
just fine when userland code is compiled with LFS support (the common
case these days).

What we really want to do is just use 64-bit numbers everywhere, unless
someone has mounted with the ino32 mount option. In that case, we want
to ensure that we hash the inode number down to something that will fit
in 32 bits before presenting the value to userland.

Add new helper functions that do this, and only do the conversion before
presenting these values to userland in getattr and readdir.

The inode table hashvalue is changed to just cast the inode number to
unsigned long, as low-order bits are the most likely to vary anyway.

While it's not strictly required, we do want to put something in
inode->i_ino. Instead of basing it on BITS_PER_LONG, however, base it on
the size of the ino_t type.

NOTE: This is a user-visible change on 32-bit arches:

1/ inode numbers will be seen to have changed between kernel versions.
   32-bit arches will see large inode numbers now instead of the hashed
   ones they saw before.

2/ any really old software not built with LFS support may start failing
   stat() calls with -EOVERFLOW on inode numbers >2^32. Nothing much we
   can do about these, but hopefully the intersection of people running
   such code on ceph will be very small.

The workaround for both problems is to mount with "-o ino32".

[ idryomov: changelog tweak ]

URL: https://tracker.ceph.com/issues/46828
Reported-by: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Reported-and-Tested-by: Tuan Hoang1 <Tuan.Hoang1@ibm.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2020-08-24 17:25:26 +02:00
..
acl.c ceph: add caps perf metric for each superblock 2020-06-01 13:22:51 +02:00
addr.c ceph: move sb->wb_pagevec_pool to be a global mempool 2020-08-04 19:41:12 +02:00
cache.c ceph: replace zero-length array with flexible-array member 2020-03-30 12:42:40 +02:00
cache.h libceph, rbd, ceph: convert to use the new mount API 2019-11-27 22:28:37 +01:00
caps.c ceph: fix inode number handling on arches with 32-bit ino_t 2020-08-24 17:25:26 +02:00
ceph_frag.c
debugfs.c ceph: fix inode number handling on arches with 32-bit ino_t 2020-08-24 17:25:26 +02:00
dir.c ceph: fix inode number handling on arches with 32-bit ino_t 2020-08-24 17:25:26 +02:00
export.c ceph: don't return -ESTALE if there's still an open file 2020-06-01 13:22:53 +02:00
file.c ceph: fix inode number handling on arches with 32-bit ino_t 2020-08-24 17:25:26 +02:00
inode.c ceph: fix inode number handling on arches with 32-bit ino_t 2020-08-24 17:25:26 +02:00
io.c ceph: add buffered/direct exclusionary locking for reads and writes 2019-09-16 12:06:25 +02:00
io.h ceph: add buffered/direct exclusionary locking for reads and writes 2019-09-16 12:06:25 +02:00
ioctl.c ceph: consider inode's last read/write when calculating wanted caps 2020-03-30 12:42:42 +02:00
ioctl.h
Kconfig libceph: replace HTTP links with HTTPS ones 2020-08-03 11:05:26 +02:00
locks.c ceph: check if file lock exists before sending unlock request 2020-03-30 12:42:40 +02:00
Makefile ceph: add dentry lease metric support 2020-06-01 13:22:51 +02:00
mds_client.c ceph: handle zero-length feature mask in session messages 2020-08-05 17:47:07 +02:00
mds_client.h ceph: fix inode number handling on arches with 32-bit ino_t 2020-08-24 17:25:26 +02:00
mdsmap.c ceph: remove unused variables in ceph_mdsmap_decode() 2020-08-03 11:05:27 +02:00
metric.c ceph: periodically send perf metrics to MDSes 2020-08-03 11:05:26 +02:00
metric.h ceph: send client provided metric flags in client metadata 2020-08-03 11:05:27 +02:00
quota.c ceph: fix inode number handling on arches with 32-bit ino_t 2020-08-24 17:25:26 +02:00
snap.c ceph: fix memory leak in ceph_cleanup_snapid_map() 2020-03-23 13:07:08 +01:00
strings.c
super.c ceph: move sb->wb_pagevec_pool to be a global mempool 2020-08-04 19:41:12 +02:00
super.h ceph: fix inode number handling on arches with 32-bit ino_t 2020-08-24 17:25:26 +02:00
util.c ceph: move net/ceph/ceph_fs.c to fs/ceph/util.c 2020-01-27 16:53:40 +01:00
xattr.c ceph: remove unnecessary cast in kfree() 2020-08-03 11:05:26 +02:00