]> git.baikalelectronics.ru Git - kernel.git/commit
bdev: Fixup error handling in blkdev_get()
authorJan Kara <jack@suse.cz>
Wed, 7 Aug 2019 09:36:47 +0000 (11:36 +0200)
committerJens Axboe <axboe@kernel.dk>
Thu, 8 Aug 2019 13:37:03 +0000 (07:37 -0600)
commit98a1cadb9582e4ec4b3089ff12ccdac5bf9f5d8c
treebb50daf2d6637e3d9e5dbab4fc613075a19af297
parent265faf1fbcea2e22ca59f411f34e5e12271f4610
bdev: Fixup error handling in blkdev_get()

Commit 71e4205fe161 ("loop: Fix mount(2) failure due to race with
LOOP_SET_FD") converted blkdev_get() to use the new helpers for
finishing claiming of a block device. However the conversion botched the
error handling in blkdev_get() and thus the bdev has been marked as held
even in case __blkdev_get() returned error. This led to occasional
warnings with block/001 test from blktests like:

kernel: WARNING: CPU: 5 PID: 907 at fs/block_dev.c:1899 __blkdev_put+0x396/0x3a0

Correct the error handling.

CC: stable@vger.kernel.org
Fixes: 71e4205fe161 ("loop: Fix mount(2) failure due to race with LOOP_SET_FD")
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/block_dev.c