]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Fix zfs_getattr_fast types
authorBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 7 Jan 2014 23:17:24 +0000 (00:17 +0100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 9 Jan 2014 23:50:23 +0000 (15:50 -0800)
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

module/zfs/zfs_vnops.c

index f56b52ace7e508d51655f1c8c7dce184f0593349..91f743aaa9300f608bcc626f33e9abcecc35b276 100644 (file)
@@ -2392,6 +2392,8 @@ zfs_getattr_fast(struct inode *ip, struct kstat *sp)
 {
        znode_t *zp = ITOZ(ip);
        zfs_sb_t *zsb = ITOZSB(ip);
+       uint32_t blksize;
+       u_longlong_t nblocks;
 
        ZFS_ENTER(zsb);
        ZFS_VERIFY_ZP(zp);
@@ -2401,7 +2403,10 @@ zfs_getattr_fast(struct inode *ip, struct kstat *sp)
        generic_fillattr(ip, sp);
        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)) {
                /*
                 * Block size hasn't been set; suggest maximal I/O transfers.