The loop device driver was broken in 2.5.38 when it was converted over
to use gendisk. I discovered this while doing final regression testing
on the ext3 htree code.
The problem is that figure_loop_size() is setting the capacity of the
loop device in kilobytes (because that's what compute_loop_size()
returns), but set_capacity() expects the size in 512 byte sectors.
I've enclosed a patch which fixes the problem, as well as simplifying
the code by eliminating compute_loop_size(), since it is a static
function is only used once by figure_loop_size().