summaryrefslogtreecommitdiff
path: root/fs/cachefiles
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2026-03-04 10:32:42 -0500
committerChristian Brauner <brauner@kernel.org>2026-03-06 14:31:28 +0100
commit0b2600f81cefcdfcda58d50df7be8fd48ada8ce2 (patch)
treec372fc873b29e01e4262c2cdc19bef7c85e0321c /fs/cachefiles
parentd84c70c6eab10e56d22c394e3a250c1c6fde8d6e (diff)
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/cachefiles')
-rw-r--r--fs/cachefiles/io.c6
-rw-r--r--fs/cachefiles/namei.c12
-rw-r--r--fs/cachefiles/xattr.c2
3 files changed, 10 insertions, 10 deletions
diff --git a/fs/cachefiles/io.c b/fs/cachefiles/io.c
index eaf47851c65f..d879b80a0bed 100644
--- a/fs/cachefiles/io.c
+++ b/fs/cachefiles/io.c
@@ -93,7 +93,7 @@ static int cachefiles_read(struct netfs_cache_resources *cres,
object = cachefiles_cres_object(cres);
file = cachefiles_cres_file(cres);
- _enter("%pD,%li,%llx,%zx/%llx",
+ _enter("%pD,%llu,%llx,%zx/%llx",
file, file_inode(file)->i_ino, start_pos, len,
i_size_read(file_inode(file)));
@@ -214,7 +214,7 @@ static int cachefiles_query_occupancy(struct netfs_cache_resources *cres,
file = cachefiles_cres_file(cres);
granularity = max_t(size_t, object->volume->cache->bsize, granularity);
- _enter("%pD,%li,%llx,%zx/%llx",
+ _enter("%pD,%llu,%llx,%zx/%llx",
file, file_inode(file)->i_ino, start, len,
i_size_read(file_inode(file)));
@@ -294,7 +294,7 @@ int __cachefiles_write(struct cachefiles_object *object,
fscache_count_write();
cache = object->volume->cache;
- _enter("%pD,%li,%llx,%zx/%llx",
+ _enter("%pD,%llu,%llx,%zx/%llx",
file, file_inode(file)->i_ino, start_pos, len,
i_size_read(file_inode(file)));
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c
index e5ec90dccc27..4fdf7687aacb 100644
--- a/fs/cachefiles/namei.c
+++ b/fs/cachefiles/namei.c
@@ -147,7 +147,7 @@ retry:
}
ASSERT(d_backing_inode(subdir));
- _debug("mkdir -> %pd{ino=%lu}",
+ _debug("mkdir -> %pd{ino=%llu}",
subdir, d_backing_inode(subdir)->i_ino);
if (_is_new)
*_is_new = true;
@@ -158,7 +158,7 @@ retry:
end_creating_keep(subdir);
if (!__cachefiles_mark_inode_in_use(NULL, d_inode(subdir))) {
- pr_notice("cachefiles: Inode already in use: %pd (B=%lx)\n",
+ pr_notice("cachefiles: Inode already in use: %pd (B=%llx)\n",
subdir, d_inode(subdir)->i_ino);
goto mark_error;
}
@@ -183,7 +183,7 @@ retry:
!d_backing_inode(subdir)->i_op->unlink)
goto check_error;
- _leave(" = [%lu]", d_backing_inode(subdir)->i_ino);
+ _leave(" = [%llu]", d_backing_inode(subdir)->i_ino);
return subdir;
check_error:
@@ -529,7 +529,7 @@ static bool cachefiles_create_file(struct cachefiles_object *object)
set_bit(FSCACHE_COOKIE_NEEDS_UPDATE, &object->cookie->flags);
set_bit(CACHEFILES_OBJECT_USING_TMPFILE, &object->flags);
- _debug("create -> %pD{ino=%lu}", file, file_inode(file)->i_ino);
+ _debug("create -> %pD{ino=%llu}", file, file_inode(file)->i_ino);
object->file = file;
return true;
}
@@ -549,7 +549,7 @@ static bool cachefiles_open_file(struct cachefiles_object *object,
_enter("%pd", dentry);
if (!cachefiles_mark_inode_in_use(object, d_inode(dentry))) {
- pr_notice("cachefiles: Inode already in use: %pd (B=%lx)\n",
+ pr_notice("cachefiles: Inode already in use: %pd (B=%llx)\n",
dentry, d_inode(dentry)->i_ino);
return false;
}
@@ -657,7 +657,7 @@ bool cachefiles_look_up_object(struct cachefiles_object *object)
if (!ret)
return false;
- _leave(" = t [%lu]", file_inode(object->file)->i_ino);
+ _leave(" = t [%llu]", file_inode(object->file)->i_ino);
return true;
new_file:
diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c
index 52383b1d0ba6..f8ae78b3f7b6 100644
--- a/fs/cachefiles/xattr.c
+++ b/fs/cachefiles/xattr.c
@@ -179,7 +179,7 @@ int cachefiles_remove_object_xattr(struct cachefiles_cache *cache,
ret = 0;
else if (ret != -ENOMEM)
cachefiles_io_error(cache,
- "Can't remove xattr from %lu"
+ "Can't remove xattr from %llu"
" (error %d)",
d_backing_inode(dentry)->i_ino, -ret);
}