mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	Fix zfs_getattr_fast types
On Sparc sp->blksize will be a 64-bit value which is then cast incorrectly to a 32-bit value. For big endian systems this results in an incorrect value for sp->blksize. To resolve the problem local variables of the correct size are used and then assigned to sp->blksize. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ned Bass <bass6@llnl.gov> Signed-off-by: marku89 <mar42@kola.li> Issue #1700
This commit is contained in:
		
							parent
							
								
									aa0218d6a1
								
							
						
					
					
						commit
						b585bc4afa
					
				| @ -2392,6 +2392,8 @@ zfs_getattr_fast(struct inode *ip, struct kstat *sp) | |||||||
| { | { | ||||||
| 	znode_t *zp = ITOZ(ip); | 	znode_t *zp = ITOZ(ip); | ||||||
| 	zfs_sb_t *zsb = ITOZSB(ip); | 	zfs_sb_t *zsb = ITOZSB(ip); | ||||||
|  | 	uint32_t blksize; | ||||||
|  | 	u_longlong_t nblocks; | ||||||
| 
 | 
 | ||||||
| 	ZFS_ENTER(zsb); | 	ZFS_ENTER(zsb); | ||||||
| 	ZFS_VERIFY_ZP(zp); | 	ZFS_VERIFY_ZP(zp); | ||||||
| @ -2401,7 +2403,10 @@ zfs_getattr_fast(struct inode *ip, struct kstat *sp) | |||||||
| 	generic_fillattr(ip, sp); | 	generic_fillattr(ip, sp); | ||||||
| 	ZFS_TIME_DECODE(&sp->atime, zp->z_atime); | 	ZFS_TIME_DECODE(&sp->atime, zp->z_atime); | ||||||
| 
 | 
 | ||||||
| 	sa_object_size(zp->z_sa_hdl, (uint32_t *)&sp->blksize, &sp->blocks); | 	sa_object_size(zp->z_sa_hdl, &blksize, &nblocks); | ||||||
|  | 	sp->blksize = blksize; | ||||||
|  | 	sp->blocks = nblocks; | ||||||
|  | 
 | ||||||
| 	if (unlikely(zp->z_blksz == 0)) { | 	if (unlikely(zp->z_blksz == 0)) { | ||||||
| 		/*
 | 		/*
 | ||||||
| 		 * Block size hasn't been set; suggest maximal I/O transfers. | 		 * Block size hasn't been set; suggest maximal I/O transfers. | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Brian Behlendorf
						Brian Behlendorf