回复:回复:回复:[PATCH] bcache: Fix bdev leak during backing device registering
From: 彭良彦 <hidden>
Date: 2017-12-01 02:30:04
Also in:
linux-bcache
On 17/12/1 上午10:13, Michael Lyle wrote:
On 11/30/2017 05:54 PM, 彭良彦 wrote:quoted
Here is the issue reproduce step. 1. create a block device sdb by iSCSI 2. echo /dev/sdb > /sys/fs/bcache/register and succeed to register //sdb is the block dev create by iSCSI 3. disconnect network and reboot // without network, SET_BDEV_STATE(&dc->sb, BDEV_STATE_NONE) will fail 4. create a block device sdb by iSCSI 5. echo /dev/sdb > /sys/fs/bcache/register and fail to register since bdev state is not reset to BDEV_STATE_NONE 6. make-bcache -B /dev/sdb --writeback --wipe-bcache the last step will fail in original version since bdev handle is not released during register and open() is failed in make-bcache, with this patch, it will succeedBut it is supposed to fail / wait in this case, if the cache device is not registered. It needs the cache device metadata in order to know the correct state of each piece of data. That is, when you are using writeback mode, you need the cache device, because some of the writes will go to the cache device and some to the backing device. Mike
If the cache device is not persistent like ramdisk, all data will be lost after reboot. We have to use make-bcache to fix the inconsistent super block of backing device.