xfs: undo block reservation correctly in xfs_trans_reserve()
authorEryu Guan <eguan@redhat.com>
Tue, 13 Sep 2016 21:39:07 +0000 (07:39 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 13 Sep 2016 21:39:07 +0000 (07:39 +1000)
"blocks" should be added back to fdblocks at undo time, not taken
away, i.e. the minus sign should not be used.

This is a regression introduced by commit 0d485ada404b ("xfs: use
generic percpu counters for free block counter"). And it's found by
code inspection, I didn't it in real world, so there's no
reproducer.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_trans.c

index 5f3d33d16e6706b9db55cb3919c35feea29408ca..836eb807aa883e8c0141a3a22836bff464e2feda 100644 (file)
@@ -217,7 +217,7 @@ undo_log:
 
 undo_blocks:
        if (blocks > 0) {
-               xfs_mod_fdblocks(tp->t_mountp, -((int64_t)blocks), rsvd);
+               xfs_mod_fdblocks(tp->t_mountp, (int64_t)blocks, rsvd);
                tp->t_blk_res = 0;
        }