BUG/PATCH race between upgrade_mode and dm_table_any_congested
A customer recently reported an Oops in dm_table_any_congested (in a
2.6.16 based kernel) that was due to dd->bdev being NULL.
so bdev_get_queue dereferenced that NULL and caused the oops.
The only credible explanation for this that we can find is that
upgrade_mode sets bdev to NULL temporarily, and does not have any
locking to exclude anything from seeing that NULL.
The code in current mainline is exactly the same so if we are correct
in our assessment, then the bug is still present.
The Oops has only occurred once and cannot be reproduced so we cannot
be certain that this is the cause. However if it really is a bug -
and there is not something else which causes mutual exclusion of
these two routines, then it should probably be fixed.
Our current patch is below. It is a big ugly, and a better fix might
be a more thorough rewrite of the code. However I offer it incase it