]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: fix missing blkdev_put() call in btrfs_scan_one_device()
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Wed, 15 Dec 2021 10:38:43 +0000 (19:38 +0900)
committerDavid Sterba <dsterba@suse.com>
Wed, 15 Dec 2021 16:07:34 +0000 (17:07 +0100)
commit6cff16668b60c7353eb44910db6cab6f869a555e
treec8340203bf9bf3d13b96c010365fddff141944a8
parentcb1b8aedfd83a5664baf362dec5e672185c53cd4
btrfs: fix missing blkdev_put() call in btrfs_scan_one_device()

The function btrfs_scan_one_device() calls blkdev_get_by_path() and
blkdev_put() to get and release its target block device. However, when
btrfs_sb_log_location_bdev() fails, blkdev_put() is not called and the
block device is left without clean up. This triggered failure of fstests
generic/085. Fix the failure path of btrfs_sb_log_location_bdev() to
call blkdev_put().

Fixes: 4c772e1914afa ("btrfs: implement log-structured superblock for ZONED mode")
CC: stable@vger.kernel.org # 5.15+
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c