Re: [PATCH v3 12/12] treewide: change inode->i_ino from unsigned long to u64

Chuck Lever
2026-03-04T15:50:20Z

On 3/4/26 10:32 AM, Jeff Layton wrote:
> On 32-bit architectures, unsigned long is only 32 bits wide, which
> causes 64-bit inode numbers to be silently truncated. Several
> filesystems (NFS, XFS, BTRFS, etc.) can generate inode numbers that
> exceed 32 bits, and this truncation can lead to inode number collisions
> and other subtle bugs on 32-bit systems.
>
> Change the type of inode->i_ino from unsigned long to u64 to ensure that
> inode numbers are always represented as 64-bit values regardless of
> architecture. Update all format specifiers treewide from %lu/%lx to
> %llu/%llx to match the new type, along with corresponding local variable
> types.
>
> This is the bulk treewide conversion. Earlier patches in this series
> handled trace events separately to allow trace field reordering for
> better struct packing on 32-bit.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> drivers/dma-buf/dma-buf.c | 2 +-
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 +--
> fs/9p/vfs_addr.c | 4 +--
> fs/9p/vfs_inode.c | 6 ++--
> fs/9p/vfs_inode_dotl.c | 6 ++--
> fs/affs/amigaffs.c | 10 +++----
> fs/affs/bitmap.c | 2 +-
> fs/affs/dir.c | 2 +-
> fs/affs/file.c | 20 ++++++-------
> fs/affs/inode.c | 12 ++++----
> fs/affs/namei.c | 14 ++++-----
> fs/affs/symlink.c | 2 +-
> fs/afs/dir.c | 10 +++----
> fs/afs/dir_search.c | 2 +-
> fs/afs/dynroot.c | 2 +-
> fs/afs/inode.c | 2 +-
> fs/autofs/inode.c | 2 +-
> fs/befs/linuxvfs.c | 28 ++++++++---------
> fs/bfs/dir.c | 4 +--
> fs/cachefiles/io.c | 6 ++--
> fs/cachefiles/namei.c | 12 ++++----
> fs/cachefiles/xattr.c | 2 +-
> fs/ceph/crypto.c | 4 +--
> fs/coda/dir.c | 2 +-
> fs/coda/inode.c | 2 +-
> fs/cramfs/inode.c | 2 +-
> fs/crypto/crypto.c | 2 +-
> fs/crypto/hooks.c | 2 +-
> fs/crypto/keyring.c | 4 +--
> fs/crypto/keysetup.c | 2 +-
> fs/dcache.c | 4 +--
> fs/ecryptfs/crypto.c | 6 ++--
> fs/ecryptfs/file.c | 2 +-
> fs/efs/inode.c | 6 ++--
> fs/eventpoll.c | 2 +-
> fs/exportfs/expfs.c | 4 +--
> fs/ext2/dir.c | 10 +++----
> fs/ext2/ialloc.c | 9 +++---
> fs/ext2/inode.c | 2 +-
> fs/ext2/xattr.c | 14 ++++-----
> fs/ext4/dir.c | 2 +-
> fs/ext4/ext4.h | 4 +--
> fs/ext4/extents.c | 8 ++---
> fs/ext4/extents_status.c | 28 ++++++++---------
> fs/ext4/fast_commit.c | 8 ++---
> fs/ext4/ialloc.c | 10 +++----
> fs/ext4/indirect.c | 2 +-
> fs/ext4/inline.c | 14 ++++-----
> fs/ext4/inode.c | 22 +++++++-------
> fs/ext4/ioctl.c | 4 +--
> fs/ext4/mballoc.c | 6 ++--
> fs/ext4/migrate.c | 2 +-
> fs/ext4/move_extent.c | 20 ++++++-------
> fs/ext4/namei.c | 10 +++----
> fs/ext4/orphan.c | 16 +++++-----
> fs/ext4/page-io.c | 10 +++----
> fs/ext4/super.c | 22 +++++++-------
> fs/ext4/xattr.c | 10 +++----
> fs/f2fs/compress.c | 4 +--
> fs/f2fs/dir.c | 2 +-
> fs/f2fs/extent_cache.c | 8 ++---
> fs/f2fs/f2fs.h | 6 ++--
> fs/f2fs/file.c | 12 ++++----
> fs/f2fs/gc.c | 2 +-
> fs/f2fs/inline.c | 4 +--
> fs/f2fs/inode.c | 48 +++++++++++++++---------------
> fs/f2fs/namei.c | 8 ++---
> fs/f2fs/node.c | 10 +++----
> fs/f2fs/recovery.c | 10 +++----
> fs/f2fs/xattr.c | 10 +++----
> fs/freevxfs/vxfs_bmap.c | 4 +--
> fs/fserror.c | 2 +-
> fs/hfs/catalog.c | 2 +-
> fs/hfs/extent.c | 4 +--
> fs/hfs/inode.c | 4 +--
> fs/hfsplus/attributes.c | 10 +++----
> fs/hfsplus/catalog.c | 2 +-
> fs/hfsplus/dir.c | 6 ++--
> fs/hfsplus/extents.c | 6 ++--
> fs/hfsplus/inode.c | 8 ++---
> fs/hfsplus/super.c | 6 ++--
> fs/hfsplus/xattr.c | 10 +++----
> fs/hpfs/dir.c | 4 +--
> fs/hpfs/dnode.c | 4 +--
> fs/hpfs/ea.c | 4 +--
> fs/hpfs/inode.c | 4 +--
> fs/inode.c | 13 ++++----
> fs/iomap/ioend.c | 2 +-
> fs/isofs/compress.c | 2 +-
> fs/isofs/dir.c | 2 +-
> fs/isofs/inode.c | 6 ++--
> fs/isofs/namei.c | 2 +-
> fs/jbd2/journal.c | 4 +--
> fs/jbd2/transaction.c | 2 +-
> fs/jffs2/dir.c | 4 +--
> fs/jffs2/file.c | 4 +--
> fs/jffs2/fs.c | 18 +++++------
> fs/jfs/inode.c | 2 +-
> fs/jfs/jfs_imap.c | 2 +-
> fs/jfs/jfs_metapage.c | 2 +-
> fs/lockd/svclock.c | 8 ++---
> fs/lockd/svcsubs.c | 2 +-
> fs/locks.c | 6 ++--
> fs/minix/inode.c | 10 +++----
> fs/nfs/dir.c | 20 ++++++-------
> fs/nfs/file.c | 8 ++---
> fs/nfs/filelayout/filelayout.c | 8 ++---
> fs/nfs/flexfilelayout/flexfilelayout.c | 8 ++---
> fs/nfs/inode.c | 6 ++--
> fs/nfs/nfs4proc.c | 4 +--
> fs/nfs/pnfs.c | 12 ++++----
> fs/nfsd/export.c | 2 +-
> fs/nfsd/nfs4state.c | 4 +--
> fs/nfsd/nfsfh.c | 4 +--
> fs/nfsd/vfs.c | 2 +-
> fs/nilfs2/alloc.c | 10 +++----
> fs/nilfs2/bmap.c | 2 +-
> fs/nilfs2/btnode.c | 2 +-
> fs/nilfs2/btree.c | 12 ++++----
> fs/nilfs2/dir.c | 12 ++++----
> fs/nilfs2/direct.c | 4 +--
> fs/nilfs2/gcinode.c | 2 +-
> fs/nilfs2/inode.c | 8 ++---
> fs/nilfs2/mdt.c | 2 +-
> fs/nilfs2/namei.c | 2 +-
> fs/nilfs2/segment.c | 2 +-
> fs/notify/fdinfo.c | 4 +--
> fs/nsfs.c | 4 +--
> fs/ntfs3/super.c | 2 +-
> fs/ocfs2/alloc.c | 2 +-
> fs/ocfs2/aops.c | 4 +--
> fs/ocfs2/dir.c | 8 ++---
> fs/ocfs2/dlmfs/dlmfs.c | 10 +++----
> fs/ocfs2/extent_map.c | 12 ++++----
> fs/ocfs2/inode.c | 2 +-
> fs/ocfs2/quota_local.c | 2 +-
> fs/ocfs2/refcounttree.c | 10 +++----
> fs/ocfs2/xattr.c | 4 +--
> fs/orangefs/inode.c | 2 +-
> fs/overlayfs/export.c | 2 +-
> fs/overlayfs/namei.c | 4 +--
> fs/overlayfs/util.c | 2 +-
> fs/pipe.c | 2 +-
> fs/proc/fd.c | 2 +-
> fs/proc/task_mmu.c | 4 +--
> fs/qnx4/inode.c | 4 +--
> fs/qnx6/inode.c | 2 +-
> fs/ubifs/debug.c | 8 ++---
> fs/ubifs/dir.c | 28 ++++++++---------
> fs/ubifs/file.c | 28 ++++++++---------
> fs/ubifs/journal.c | 6 ++--
> fs/ubifs/super.c | 16 +++++-----
> fs/ubifs/tnc.c | 4 +--
> fs/ubifs/xattr.c | 14 ++++-----
> fs/udf/directory.c | 18 +++++------
> fs/udf/file.c | 2 +-
> fs/udf/inode.c | 12 ++++----
> fs/udf/namei.c | 8 ++---
> fs/udf/super.c | 2 +-
> fs/ufs/balloc.c | 6 ++--
> fs/ufs/dir.c | 10 +++----
> fs/ufs/ialloc.c | 6 ++--
> fs/ufs/inode.c | 18 +++++------
> fs/ufs/ufs_fs.h | 6 ++--
> fs/ufs/util.c | 2 +-
> fs/verity/init.c | 2 +-
> fs/zonefs/super.c | 8 ++---
> include/linux/fs.h | 2 +-
> kernel/events/uprobes.c | 4 +--
> net/netrom/af_netrom.c | 4 +--
> net/rose/af_rose.c | 4 +--
> net/socket.c | 2 +-
> net/x25/x25_proc.c | 4 +--
> security/apparmor/apparmorfs.c | 4 +--
> security/integrity/integrity_audit.c | 2 +-
> security/ipe/audit.c | 2 +-
> security/lsm_audit.c | 10 +++----
> security/selinux/hooks.c | 10 +++----
> security/smack/smack_lsm.c | 12 ++++----
> 179 files changed, 607 insertions(+), 607 deletions(-)

> diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
> index 8fdbba7cad96443d92cc7fdeea6158c4cc681be1..d2259d948cc33e1c192531d34679123b826cf4dc 100644
> --- a/fs/nfsd/export.c
> +++ b/fs/nfsd/export.c
> @@ -1039,7 +1039,7 @@ exp_rootfh(struct net *net, struct auth_domain *clp, char *name,
> }
> inode = d_inode(path.dentry);
>
> - dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n",
> + dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%llu)\n",
> name, path.dentry, clp->name,
> inode->i_sb->s_id, inode->i_ino);
> exp = exp_parent(cd, clp, &path);
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 6b9c399b89dfb71a52b9c97f0efe9a1dea0558a6..a569d89ac9123d66bb47e7d74c7c98610de21da2 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -1253,7 +1253,7 @@ static void nfsd4_finalize_deleg_timestamps(struct nfs4_delegation *dp, struct f
> if (ret) {
> struct inode *inode = file_inode(f);
>
> - pr_notice_ratelimited("nfsd: Unable to update timestamps on inode %02x:%02x:%lu: %d\n",
> + pr_notice_ratelimited("nfsd: Unable to update timestamps on inode %02x:%02x:%llu: %d\n",
> MAJOR(inode->i_sb->s_dev),
> MINOR(inode->i_sb->s_dev),
> inode->i_ino, ret);
> @@ -2888,7 +2888,7 @@ static void nfs4_show_superblock(struct seq_file *s, struct nfsd_file *f)
> {
> struct inode *inode = file_inode(f->nf_file);
>
> - seq_printf(s, "superblock: \"%02x:%02x:%ld\"",
> + seq_printf(s, "superblock: \"%02x:%02x:%llu\"",
> MAJOR(inode->i_sb->s_dev),
> MINOR(inode->i_sb->s_dev),
> inode->i_ino);
> diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
> index ed85dd43da18e6d4c4667ff14dc035f2eacff1d6..ee72c9565e4fe85356674b22b4505d3d531dbe40 100644
> --- a/fs/nfsd/nfsfh.c
> +++ b/fs/nfsd/nfsfh.c
> @@ -601,9 +601,9 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
> struct inode * inode = d_inode(dentry);
> dev_t ex_dev = exp_sb(exp)->s_dev;
>
> - dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %pd2, ino=%ld)\n",
> + dprintk("nfsd: fh_compose(exp %02x:%02x/%llu %pd2, ino=%llu)\n",
> MAJOR(ex_dev), MINOR(ex_dev),
> - (long) d_inode(exp->ex_path.dentry)->i_ino,
> + d_inode(exp->ex_path.dentry)->i_ino,
> dentry,
> (inode ? inode->i_ino : 0));
>
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index c884c3f34afb044ee5cacc962a04a97de2f7fd88..eafdf7b7890fdee55ddf802d040363f33a7be628 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -1163,7 +1163,7 @@ nfsd_direct_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
> } else if (unlikely(host_err == -EINVAL)) {
> struct inode *inode = d_inode(fhp->fh_dentry);
>
> - pr_info_ratelimited("nfsd: Direct I/O alignment failure on %s/%ld\n",
> + pr_info_ratelimited("nfsd: Direct I/O alignment failure on %s/%llu\n",
> inode->i_sb->s_id, inode->i_ino);
> host_err = -ESERVERFAULT;
> }
For the NFSD hunks:

Reviewed-by: Chuck Lever <chuck.lever@oracle.com>

--
Chuck Lever