]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
xfs: bulkstat chunk formatting cursor is broken
authorDave Chinner <dchinner@redhat.com>
Thu, 6 Nov 2014 21:30:30 +0000 (08:30 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Nov 2014 18:10:40 +0000 (10:10 -0800)
commit8ee218f083fc71c742d4319a43d73e791f3d0e8b
tree5726aed839ba65fc105cbfd345ef05ea4a0400f8
parent6de2ef500fca4fe624b759faba57d523841f9f65
xfs: bulkstat chunk formatting cursor is broken

commit bf4a5af20d25ecc8876978ad34b8db83b4235f3c upstream.

The xfs_bulkstat_agichunk formatting cursor takes buffer values from
the main loop and passes them via the structure to the chunk
formatter, and the writes the changed values back into the main loop
local variables. Unfortunately, this complex dance is full of corner
cases that aren't handled correctly.

The biggest problem is that it is double handling the information in
both the main loop and the chunk formatting function, leading to
inconsistent updates and endless loops where progress is not made.

To fix this, push the struct xfs_bulkstat_agichunk outwards to be
the primary holder of user buffer information. this removes the
double handling in the main loop.

Also, pass the last inode processed by the chunk formatter as a
separate parameter as it purely an output variable and is not
related to the user buffer consumption cursor.

Finally, the chunk formatting code is not shared by anyone, so make
it local to xfs_itable.c.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_itable.c
fs/xfs/xfs_itable.h