mksquashfs: fix recursive restore failure check

Fix recursive failure in restoring check by moving it to
prep_exit() and from restorefs(), this is because due to the
changes where all restoring is now done on the restore thread,
restorefs() is no longer recursively called, only prep_exit()
is now recursively called.

Whilst doing this, take advantage of the situation where restoring
is now only done on the restore thread to fix a theorectical
race condition with the previous code.  The previous code identified
recursive failure by incrementing the restoring flag every time it
was called, if the restore flag increased beyond one then we had
recursion, unfortunately this did not handle the case where two or more
threads simultaneously entered the restoring code but before restoring
took place, each thread would increment the flag making it look like
recursive restoring had taken place.  The new code fixes this by
checking if the restore thread has entered prep_exit(), if it has
then we have recursive failure.  This is a much more specific check
which allows multiple threads to fail and enter the restore code
simultaneously.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
2 files changed
tree: 893844cca85ae168af05af431ead0ecdcf4514e6
  1. kernel/
  2. kernel-2.4/
  3. squashfs-tools/
  4. README