xfs: fix delalloc quota accounting on failure
authorDave Chinner <dchinner@redhat.com>
Tue, 8 May 2012 10:48:53 +0000 (20:48 +1000)
committerBen Myers <bpm@sgi.com>
Mon, 21 May 2012 15:45:43 +0000 (10:45 -0500)
commitea562ed6e7df5acd9392d993882c39e855099165
tree0f91e73ae2adba9e0469a7a87abe44c13a880c70
parent1307bbd2af67283131728637e9489002adb26f10
xfs: fix delalloc quota accounting on failure

xfstest 270 was causing quota reservations way beyond what was sane
(ten to hundreds of TB) for a 4GB filesystem. There's a sign problem
in the error handling path of xfs_bmapi_reserve_delalloc() because
xfs_trans_unreserve_quota_nblks() simple negates the value passed -
which doesn't work for an unsigned variable. This causes
reservations of close to 2^32 block instead of removing a
reservation of a handful of blocks.

Fix the same problem in the other xfs_trans_unreserve_quota_nblks()
callers where unsigned integer variables are used, too.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
fs/xfs/xfs_bmap.c
fs/xfs/xfs_iomap.c
fs/xfs/xfs_vnodeops.c