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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Apr 2020 08:38:04 +0000 (10:38 +0200)
commit94b6df1cf6761672a03f733eea81f14482d2b70c
tree58bdf8446f5e1e58f245254fcb092f0969992453
parentfd6d36892af482fafb7ed0c34a0efc59b865cf51
xfs: fix regression in "cleanup xfs_dir2_block_getdents"

[ Upstream commit 3d28e7e278913a267b1de360efcd5e5274065ce2 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/xfs/xfs_dir2_readdir.c