xfs: fix regression in "cleanup xfs_dir2_block_getdents"
authorTommi Rantala <tommi.t.rantala@nokia.com>
Thu, 12 Mar 2020 14:43:53 +0000 (07:43 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Fri, 13 Mar 2020 17:37:13 +0000 (10:37 -0700)
commit3d28e7e278913a267b1de360efcd5e5274065ce2
treea272dbc5868529172a2cad79fae983cc3202f493
parent17bb60b74124e9491d593e2601e3afe14daa2f57
xfs: fix regression in "cleanup xfs_dir2_block_getdents"

Commit 263dde869bd09 ("xfs: cleanup xfs_dir2_block_getdents") introduced
a getdents regression, when it converted the pointer arithmetics to
offset calculations: offset is updated in the loop already for the next
iteration, but the updated offset value is used incorrectly in two
places, where we should have used the not-yet-updated value.

This caused for example "git clean -ffdx" failures to cleanup certain
directory structures when running in a container.

Fix the regression by making sure we use proper offset in the loop body.
Thanks to Christoph Hellwig for suggestion how to best fix the code.

Cc: Christoph Hellwig <hch@lst.de>
Fixes: 263dde869bd09 ("xfs: cleanup xfs_dir2_block_getdents")
Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/xfs_dir2_readdir.c