diff options
| author | Jeff Layton <jlayton@kernel.org> | 2026-03-04 10:32:42 -0500 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-03-06 14:31:28 +0100 |
| commit | 0b2600f81cefcdfcda58d50df7be8fd48ada8ce2 (patch) | |
| tree | c372fc873b29e01e4262c2cdc19bef7c85e0321c /fs/afs | |
| parent | d84c70c6eab10e56d22c394e3a250c1c6fde8d6e (diff) | |
| download | linux-next-0b2600f81cefcdfcda58d50df7be8fd48ada8ce2.tar.gz linux-next-0b2600f81cefcdfcda58d50df7be8fd48ada8ce2.zip | |
treewide: change inode->i_ino from unsigned long to u64
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>
Link: https://patch.msgid.link/20260304-iino-u64-v3-12-2257ad83d372@kernel.org
Acked-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/afs')
| -rw-r--r-- | fs/afs/dir.c | 10 | ||||
| -rw-r--r-- | fs/afs/dir_search.c | 2 | ||||
| -rw-r--r-- | fs/afs/dynroot.c | 2 | ||||
| -rw-r--r-- | fs/afs/inode.c | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 78caef3f1338..aaaa55878ffd 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -148,7 +148,7 @@ static bool afs_dir_check_block(struct afs_vnode *dvnode, size_t progress, union afs_xdr_dir_block *block) { if (block->hdr.magic != AFS_DIR_MAGIC) { - pr_warn("%s(%lx): [%zx] bad magic %04x\n", + pr_warn("%s(%llx): [%zx] bad magic %04x\n", __func__, dvnode->netfs.inode.i_ino, progress, ntohs(block->hdr.magic)); trace_afs_dir_check_failed(dvnode, progress); @@ -214,7 +214,7 @@ static int afs_dir_check(struct afs_vnode *dvnode) */ static int afs_dir_open(struct inode *inode, struct file *file) { - _enter("{%lu}", inode->i_ino); + _enter("{%llu}", inode->i_ino); BUILD_BUG_ON(sizeof(union afs_xdr_dir_block) != 2048); BUILD_BUG_ON(sizeof(union afs_xdr_dirent) != 32); @@ -523,7 +523,7 @@ static int afs_dir_iterate(struct inode *dir, struct dir_context *ctx, int retry_limit = 100; int ret; - _enter("{%lu},%llx,,", dir->i_ino, ctx->pos); + _enter("{%llu},%llx,,", dir->i_ino, ctx->pos); do { if (--retry_limit < 0) { @@ -610,7 +610,7 @@ static int afs_do_lookup_one(struct inode *dir, const struct qstr *name, }; int ret; - _enter("{%lu},{%.*s},", dir->i_ino, name->len, name->name); + _enter("{%llu},{%.*s},", dir->i_ino, name->len, name->name); /* search the directory */ ret = afs_dir_iterate(dir, &cookie.ctx, NULL, _dir_version); @@ -783,7 +783,7 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry) long ret; int i; - _enter("{%lu},%p{%pd},", dir->i_ino, dentry, dentry); + _enter("{%llu},%p{%pd},", dir->i_ino, dentry, dentry); cookie = kzalloc_obj(struct afs_lookup_cookie); if (!cookie) diff --git a/fs/afs/dir_search.c b/fs/afs/dir_search.c index d2516e55b5ed..104411c0692f 100644 --- a/fs/afs/dir_search.c +++ b/fs/afs/dir_search.c @@ -194,7 +194,7 @@ int afs_dir_search(struct afs_vnode *dvnode, const struct qstr *name, struct afs_dir_iter iter = { .dvnode = dvnode, }; int ret, retry_limit = 3; - _enter("{%lu},,,", dvnode->netfs.inode.i_ino); + _enter("{%llu},,,", dvnode->netfs.inode.i_ino); if (!afs_dir_init_iter(&iter, name)) return -ENOENT; diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c index aa56e8951e03..1d5e33bc7502 100644 --- a/fs/afs/dynroot.c +++ b/fs/afs/dynroot.c @@ -59,7 +59,7 @@ static struct inode *afs_iget_pseudo_dir(struct super_block *sb, ino_t ino) return ERR_PTR(-ENOMEM); } - _debug("GOT INODE %p { ino=%lu, vl=%llx, vn=%llx, u=%x }", + _debug("GOT INODE %p { ino=%llu, vl=%llx, vn=%llx, u=%x }", inode, inode->i_ino, fid.vid, fid.vnode, fid.unique); vnode = AFS_FS_I(inode); diff --git a/fs/afs/inode.c b/fs/afs/inode.c index dde1857fcabb..a5173434f786 100644 --- a/fs/afs/inode.c +++ b/fs/afs/inode.c @@ -683,7 +683,7 @@ int afs_getattr(struct mnt_idmap *idmap, const struct path *path, struct key *key; int ret, seq; - _enter("{ ino=%lu v=%u }", inode->i_ino, inode->i_generation); + _enter("{ ino=%llu v=%u }", inode->i_ino, inode->i_generation); if (vnode->volume && !(query_flags & AT_STATX_DONT_SYNC) && |
