]> git.baikalelectronics.ru Git - kernel.git/commit
dm log writes: move IO accounting earlier to fix error path
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 30 Aug 2016 20:11:53 +0000 (16:11 -0400)
committerMike Snitzer <snitzer@redhat.com>
Tue, 30 Aug 2016 20:16:49 +0000 (16:16 -0400)
commitd98e937df48c055baf737b79feeedb0115d7b84d
treef7b3d3e7501084c2228997f074b3978a81918bab
parentf987612db0506b2cba4d9cae824062f861e0f3f2
dm log writes: move IO accounting earlier to fix error path

Move log_one_block()'s atomic_inc(&lc->io_blocks) before bio_alloc() to
fix a bug that the target hangs if bio_alloc() fails.  The error path
does put_io_block(lc), so atomic_inc(&lc->io_blocks) must occur before
invoking the error path to avoid underflow of lc->io_blocks.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reviewed-by: Josef Bacik <jbacik@fb,com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org
drivers/md/dm-log-writes.c