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/jffs2 | |
| parent | d84c70c6eab10e56d22c394e3a250c1c6fde8d6e (diff) | |
| download | lwn-0b2600f81cefcdfcda58d50df7be8fd48ada8ce2.tar.gz lwn-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/jffs2')
| -rw-r--r-- | fs/jffs2/dir.c | 4 | ||||
| -rw-r--r-- | fs/jffs2/file.c | 4 | ||||
| -rw-r--r-- | fs/jffs2/fs.c | 18 |
3 files changed, 13 insertions, 13 deletions
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index 2b38ce1fd8e8..c4088c3b4ac0 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c @@ -129,7 +129,7 @@ static int jffs2_readdir(struct file *file, struct dir_context *ctx) struct jffs2_full_dirent *fd; unsigned long curofs = 1; - jffs2_dbg(1, "jffs2_readdir() for dir_i #%lu\n", inode->i_ino); + jffs2_dbg(1, "jffs2_readdir() for dir_i #%llu\n", inode->i_ino); if (!dir_emit_dots(file, ctx)) return 0; @@ -211,7 +211,7 @@ static int jffs2_create(struct mnt_idmap *idmap, struct inode *dir_i, jffs2_free_raw_inode(ri); - jffs2_dbg(1, "%s(): Created ino #%lu with mode %o, nlink %d(%d). nrpages %ld\n", + jffs2_dbg(1, "%s(): Created ino #%llu with mode %o, nlink %d(%d). nrpages %ld\n", __func__, inode->i_ino, inode->i_mode, inode->i_nlink, f->inocache->pino_nlink, inode->i_mapping->nrpages); diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index 5e1ef4bc009b..1e18d3a79840 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c @@ -88,7 +88,7 @@ static int jffs2_do_readpage_nolock(struct inode *inode, struct folio *folio) unsigned char *kaddr; int ret; - jffs2_dbg(2, "%s(): ino #%lu, page at offset 0x%lx\n", + jffs2_dbg(2, "%s(): ino #%llu, page at offset 0x%lx\n", __func__, inode->i_ino, folio->index << PAGE_SHIFT); BUG_ON(!folio_test_locked(folio)); @@ -259,7 +259,7 @@ static int jffs2_write_end(const struct kiocb *iocb, uint32_t writtenlen = 0; void *buf; - jffs2_dbg(1, "%s(): ino #%lu, page at 0x%llx, range %d-%d, flags %lx\n", + jffs2_dbg(1, "%s(): ino #%llu, page at 0x%llx, range %d-%d, flags %lx\n", __func__, inode->i_ino, folio_pos(folio), start, end, folio->flags.f); diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index c3ce2c868f7a..6ada8369a762 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c @@ -43,7 +43,7 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) int ret; int alloc_type = ALLOC_NORMAL; - jffs2_dbg(1, "%s(): ino #%lu\n", __func__, inode->i_ino); + jffs2_dbg(1, "%s(): ino #%llu\n", __func__, inode->i_ino); /* Special cases - we don't want more than one data node for these types on the medium at any time. So setattr @@ -243,7 +243,7 @@ void jffs2_evict_inode (struct inode *inode) struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); - jffs2_dbg(1, "%s(): ino #%lu mode %o\n", + jffs2_dbg(1, "%s(): ino #%llu mode %o\n", __func__, inode->i_ino, inode->i_mode); truncate_inode_pages_final(&inode->i_data); clear_inode(inode); @@ -334,8 +334,8 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino) ret = jffs2_read_dnode(c, f, f->metadata, (char *)&jdev, 0, f->metadata->size); if (ret < 0) { /* Eep */ - pr_notice("Read device numbers for inode %lu failed\n", - (unsigned long)inode->i_ino); + pr_notice("Read device numbers for inode %llu failed\n", + inode->i_ino); goto error; } if (f->metadata->size == sizeof(jdev.old_id)) @@ -351,8 +351,8 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino) break; default: - pr_warn("%s(): Bogus i_mode %o for ino %lu\n", - __func__, inode->i_mode, (unsigned long)inode->i_ino); + pr_warn("%s(): Bogus i_mode %o for ino %llu\n", + __func__, inode->i_mode, inode->i_ino); } mutex_unlock(&f->sem); @@ -374,12 +374,12 @@ void jffs2_dirty_inode(struct inode *inode, int flags) struct iattr iattr; if (!(inode_state_read_once(inode) & I_DIRTY_DATASYNC)) { - jffs2_dbg(2, "%s(): not calling setattr() for ino #%lu\n", + jffs2_dbg(2, "%s(): not calling setattr() for ino #%llu\n", __func__, inode->i_ino); return; } - jffs2_dbg(1, "%s(): calling setattr() for ino #%lu\n", + jffs2_dbg(1, "%s(): calling setattr() for ino #%llu\n", __func__, inode->i_ino); iattr.ia_valid = ATTR_MODE|ATTR_UID|ATTR_GID|ATTR_ATIME|ATTR_MTIME|ATTR_CTIME; @@ -428,7 +428,7 @@ struct inode *jffs2_new_inode (struct inode *dir_i, umode_t mode, struct jffs2_r struct jffs2_inode_info *f; int ret; - jffs2_dbg(1, "%s(): dir_i %ld, mode 0x%x\n", + jffs2_dbg(1, "%s(): dir_i %llu, mode 0x%x\n", __func__, dir_i->i_ino, mode); c = JFFS2_SB_INFO(sb); |
