]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_repair: fix prefetch queue waiting
authorEric Sandeen <sandeen@redhat.com>
Tue, 8 Apr 2014 08:56:59 +0000 (18:56 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 8 Apr 2014 08:56:59 +0000 (18:56 +1000)
commitf994d14f8da28c7a307c09142c70349bc59b4434
tree801c7a2a0be1f0df4efa81858f613dc7945195d6
parent0a3717c91c62fecc53d79a247c975015f058dce1
xfs_repair: fix prefetch queue waiting

97b1fcf xfs_repair: fix array overrun in do_inode_prefetch

The thread creation loop has 2 ways to exit; either via
the loop counter based on thread_count, or the break statement
if we've started enough workers to cover all AGs.

Whether or not the loop counter "i" reflects the number of
threads started depends on whether or not we exited via the
break.

The above commit prevented us from indexing off the end
of the queues[] array if we actually advanced "i" all the
way to thread_count, but in the case where we break, "i"
is one *less* than the nr of threads started, so we don't
wait for completion of all threads, and all hell breaks
loose in phase 5.

Just stop with the cleverness of re-using the loop counter -
instead, explicitly count threads that we start, and then use
that counter to wait for each worker to complete.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/prefetch.c