md_make_request: don't touch the bio after calling make_request
authorChris Mason <chris.mason@oracle.com>
Tue, 8 Feb 2011 00:21:48 +0000 (19:21 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 17 Feb 2011 22:47:24 +0000 (14:47 -0800)
commit823c5c79a5da97b6f4314be7d0f350fdc19df9b7
treed65ebc14c798434bf2d7ecedfebd82b3a4c40346
parent4f8fa9bc7226ba1581e63e3ff1b583f5c1026edd
md_make_request: don't touch the bio after calling make_request

commit e91ece5590b3c728624ab57043fc7a05069c604a upstream.

md_make_request was calling bio_sectors() for part_stat_add
after it was calling the make_request function.  This is
bad because the make_request function can free the bio and
because the bi_size field can change around.

The fix here was suggested by Jens Axboe.  It saves the
sector count before the make_request call.  I hit this
with CONFIG_DEBUG_PAGEALLOC turned on while trying to break
his pretty fusionio card.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/md/md.c