tmpfs: Don't use 64-bit inodes by defulat with 32-bit ino_t
Subsystems (3)
PATCH 1/1 tmpfs: Don't use 64-bit inodes by defulat with 32-bit ino_t
Currently there seems to be an assumption in tmpfs that 64-bit architectures also have a 64-bit ino_t. This is not true; s390 at least has a 32-bit ino_t. With CONFIG_TMPFS_INODE64=y tmpfs mounts will get 64-bit inode numbers and display "inode64" in the mount options, but passing the "inode64" mount option will fail. This leads to the following behavior:
# mkdir mnt # mount -t tmpfs nodev mnt # mount -o remount,rw mnt mount: /home/ubuntu/mnt: mount point not mounted or bad option.
As mount sees "inode64" in the mount options and thus passes it in the options for the remount.
Ideally CONFIG_TMPFS_INODE64 would depend on sizeof(ino_t) < 8, but I don't think it's possible to test for this (potentially CONFIG_ARCH_HAS_64BIT_INO_T or similar could be added, but I'm not sure whether or not that is wanted). So fix this by simply refusing to honor the CONFIG_TMPFS_INODE64 setting when sizeof(ino_t) < 8.
--- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/shmem.c +1 -1
@@ -3733,7 +3733,7 @@ static int shmem_fill_super(struct super_block *sb, struct fs_context *fc) ctx->blocks =shmem_default_max_blocks ();if (!(ctx->seen &SHMEM_SEEN_INODES )) ctx->inodes =shmem_default_max_inodes (); -if (!(ctx->seen &SHMEM_SEEN_INUMS )) +if (!(ctx->seen &SHMEM_SEEN_INUMS ) &&sizeof (ino_t) >=8 ) ctx->full_inums =IS_ENABLED (CONFIG_TMPFS_INODE64 ); }else { sb->s_flags |=SB_NOUSER ;
Signature · 1 line
2.29.2
Andrew Morton
maintainerQuoted 15 lines · On Fri, 5 Feb 2021 14:21:59 -0600 Seth Forshee <[email protected]>…
Currently there seems to be an assumption in tmpfs that 64-bit architectures also have a 64-bit
ino_t. This is not true; s390 at least has a 32-bitino_t. WithCONFIG_TMPFS_INODE64=ytmpfs mounts will get 64-bit inode numbers and display "inode64" in the mount options, but passing the "inode64" mount option will fail. This leads to the following behavior:# mkdir mnt # mount -t tmpfs nodev mnt # mount -o remount,rw mnt mount: /home/ubuntu/mnt: mount point not mounted or bad option.As mount sees "inode64" in the mount options and thus passes it in the options for the remount.
Quoted 6 lines
Ideally
CONFIG_TMPFS_INODE64would depend onsizeof(ino_t)< 8, but I don't think it's possible to test for this (potentiallyCONFIG_ARCH_HAS_64BIT_INO_Tor similar could be added, but I'm not sure whether or not that is wanted). So fix this by simply refusing to honor theCONFIG_TMPFS_INODE64setting whensizeof(ino_t)< 8.
How about changing s390 Kconfig so that CONFIG_TMPFS_INODE64 is not enabled?
Quoted 2 lines
Fixes ea3271f7196c ("tmpfs: support 64-bit inums per-sb")Signed-off-by Seth Forshee <[email protected]>
With a cc:stable, I assume?
Quoted 17 lines · Andrew Morton
Quoted 15 lines · On Fri, 5 Feb 2021 14:21:59 -0600 Seth Forshee <[email protected]>…
Currently there seems to be an assumption in tmpfs that 64-bit architectures also have a 64-bit
ino_t. This is not true; s390 at least has a 32-bitino_t. WithCONFIG_TMPFS_INODE64=ytmpfs mounts will get 64-bit inode numbers and display "inode64" in the mount options, but passing the "inode64" mount option will fail. This leads to the following behavior:# mkdir mnt # mount -t tmpfs nodev mnt # mount -o remount,rw mnt mount: /home/ubuntu/mnt: mount point not mounted or bad option.As mount sees "inode64" in the mount options and thus passes it in the options for the remount.
Quoted 8 lines
Quoted 6 lines
Ideally
CONFIG_TMPFS_INODE64would depend onsizeof(ino_t)< 8, but I don't think it's possible to test for this (potentiallyCONFIG_ARCH_HAS_64BIT_INO_Tor similar could be added, but I'm not sure whether or not that is wanted). So fix this by simply refusing to honor theCONFIG_TMPFS_INODE64setting whensizeof(ino_t)< 8.How about changing s390
Kconfigso thatCONFIG_TMPFS_INODE64is not enabled?
I did do that for our config. I see the s390 defconfig has it enabled, so I will send a patch for that too. But the fact that it can be configured that way and that the code behaves badly still seems problematic.
Quoted 5 lines
Quoted 3 lines
Fixes ea3271f7196c ("tmpfs: support 64-bit inums per-sb")Signed-off-by Seth Forshee <[email protected]>With a cc:stable, I assume?
Yes, I forgot that. Thanks.
Seth
Andrew Morton
maintainerQuoted 25 lines · On Fri, 5 Feb 2021 14:55:43 -0600 Seth Forshee <[email protected]>…
Quoted 24 lines · Andrew Morton
Quoted 21 lines · On Fri, 5 Feb 2021 14:21:59 -0600 Seth Forshee <[email protected]>…
Currently there seems to be an assumption in tmpfs that 64-bit architectures also have a 64-bit
ino_t. This is not true; s390 at least has a 32-bitino_t. WithCONFIG_TMPFS_INODE64=ytmpfs mounts will get 64-bit inode numbers and display "inode64" in the mount options, but passing the "inode64" mount option will fail. This leads to the following behavior:# mkdir mnt # mount -t tmpfs nodev mnt # mount -o remount,rw mnt mount: /home/ubuntu/mnt: mount point not mounted or bad option.As mount sees "inode64" in the mount options and thus passes it in the options for the remount.
Ideally
CONFIG_TMPFS_INODE64would depend onsizeof(ino_t)< 8, but I don't think it's possible to test for this (potentiallyCONFIG_ARCH_HAS_64BIT_INO_Tor similar could be added, but I'm not sure whether or not that is wanted). So fix this by simply refusing to honor theCONFIG_TMPFS_INODE64setting whensizeof(ino_t)< 8.
Quoted 6 lines
Quoted 1 line
How about changing s390
Kconfigso thatCONFIG_TMPFS_INODE64is not enabled?I did do that for our config. I see the s390 defconfig has it enabled, so I will send a patch for that too. But the fact that it can be configured that way and that the code behaves badly still seems problematic.
I meant
fs/Kconfig renamed from fs/Kconfig~a +1 -1
@@ -203,7 +203,7 @@ config TMPFS_XATTR config TMPFS_INODE64 bool "Use 64-bit ino_t by default in tmpfs" - depends on TMPFS && 64BIT + depends on TMPFS && 64BIT && !S390 default n help tmpfs has historically used only inode numbers as wide as an unsigned
_
Quoted 47 lines · Andrew Morton
Quoted 25 lines · On Fri, 5 Feb 2021 14:55:43 -0600 Seth Forshee <[email protected]>…
Quoted 24 lines · Andrew Morton
Quoted 21 lines · On Fri, 5 Feb 2021 14:21:59 -0600 Seth Forshee <[email protected]>…
Currently there seems to be an assumption in tmpfs that 64-bit architectures also have a 64-bit
ino_t. This is not true; s390 at least has a 32-bitino_t. WithCONFIG_TMPFS_INODE64=ytmpfs mounts will get 64-bit inode numbers and display "inode64" in the mount options, but passing the "inode64" mount option will fail. This leads to the following behavior:# mkdir mnt # mount -t tmpfs nodev mnt # mount -o remount,rw mnt mount: /home/ubuntu/mnt: mount point not mounted or bad option.As mount sees "inode64" in the mount options and thus passes it in the options for the remount.
Ideally
CONFIG_TMPFS_INODE64would depend onsizeof(ino_t)< 8, but I don't think it's possible to test for this (potentiallyCONFIG_ARCH_HAS_64BIT_INO_Tor similar could be added, but I'm not sure whether or not that is wanted). So fix this by simply refusing to honor theCONFIG_TMPFS_INODE64setting whensizeof(ino_t)< 8.Quoted 6 lines
Quoted 1 line
How about changing s390
Kconfigso thatCONFIG_TMPFS_INODE64is not enabled?I did do that for our config. I see the s390 defconfig has it enabled, so I will send a patch for that too. But the fact that it can be configured that way and that the code behaves badly still seems problematic.
I meant
fs/Kconfig renamed from fs/Kconfig~a +1
-1@@ -203,7 +203,7 @@ config TMPFS_XATTR config TMPFS_INODE64 bool "Use 64-bit ino_t by default in tmpfs" - depends on TMPFS && 64BIT + depends on TMPFS && 64BIT && !S390 default n help tmpfs has historically used only inode numbers as wide as an unsigned
Quoted 1 line
_
Ah. s390 does appear to be the only architecture that doesn't use unsigned long for ino_t, so that seems good to me. I can send a patch if you want, but seems like you've already got one ...
Seth