Skip to content

Commit

Permalink
[GFS2] Fix cast from unsigned int to s64
Browse files Browse the repository at this point in the history
This fixes bz 444829 where allocating a new block caused gfs2 file systems to
report 0 bytes used in df. It was caused by a broken cast from an unsigned int
in gfs2_block_alloc() to a negative s64 in gfs2_statfs_change(). This patch
casts the unsigned int to an s64 before the unary minus is applied.

Signed-off-by: Andrew Price <andy@andrewprice.me.uk>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
  • Loading branch information
Andrew Price authored and Steven Whitehouse committed May 12, 2008
1 parent 091806e commit ad99f77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/gfs2/rgrp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ u64 gfs2_alloc_block(struct gfs2_inode *ip, unsigned int *n)

al->al_alloced += *n;

gfs2_statfs_change(sdp, 0, -*n, 0);
gfs2_statfs_change(sdp, 0, -(s64)*n, 0);
gfs2_quota_change(ip, *n, ip->i_inode.i_uid, ip->i_inode.i_gid);

spin_lock(&sdp->sd_rindex_spin);
Expand Down

0 comments on commit ad99f77

Please sign in to comment.