ext4: fix xattr block allocation/release with bigalloc
authorLukas Czerner <lczerner@redhat.com>
Mon, 18 Feb 2013 17:12:07 +0000 (12:12 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 6 Mar 2013 03:24:03 +0000 (03:24 +0000)
commitf861f64d9250a14a1b84e1edf3f6d0531fc37a0c
treea6fd3915b13ee5713856a298f76de957c683a0da
parent59222bdd5b2a0e4f868d867a71397945236c1412
ext4: fix xattr block allocation/release with bigalloc

commit 1231b3a1eb5740192aeebf5344dd6d6da000febf upstream.

Currently when new xattr block is created or released we we would call
dquot_free_block() or dquot_alloc_block() respectively, among the else
decrementing or incrementing the number of blocks assigned to the
inode by one block.

This however does not work for bigalloc file system because we always
allocate/free the whole cluster so we have to count with that in
dquot_free_block() and dquot_alloc_block() as well.

Use the clusters-to-blocks conversion EXT4_C2B() when passing number of
blocks to the dquot_alloc/free functions to fix the problem.

The problem has been revealed by xfstests #117 (and possibly others).

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/ext4/xattr.c