On Tue, May 03, 2016 at 11:34:50PM +0300, Yauhen Kharuzhy wrote: > On Tue, May 03, 2016 at 07:31:48PM +0200, David Sterba wrote: > > On Thu, Apr 14, 2016 at 06:24:10PM +0800, Anand Jain wrote: > > > Yauhen reported in the ML that s_bdev is null at mount, and > > > s_bdev gets updated to some device when missing device is > > > replaced, as because bdev is null for missing device, things > > > gets matched up. Fix this by checking if s_bdev is set. I > > > didn't want to completely remove updating s_bdev because > > > the future multi device support at vfs layer may need it. > > > > > > Signed-off-by: Anand Jain <[email protected]> > > > Reported-by: Yauhen Kharuzhy <[email protected]> > > > > Do you have a testcase for that? As there are more patches touching the > > device pointers I'd rather see some test coverage. Thanks. > > Testcase is ('global spare' patchset is needed for device closing > support): > > 1) create RAID, mount -> s_bdev is NULL sorry, for match old s_bdev (NULL) with replaced device:
1.1) remove latest drive and touch FS to make device missing -> device->bdev is NULL > 2) replace latest device by another -> s_bdev is bdev of new drive > 3) remove drive added by replace > 4) touch mountpount and do btrfs fi sync (device will be closed and > marked as missing here) -> s_bdev is invalid pointer to closed and freed > bdev > 5) unmount FS -> oops > > Something like: > > mkfs.btrfs -d raid5 -m raid5 <dev1> <dev2>... <devN-1> > mount <dev1> /mnt _devmgt_remove <devN-1> touch /mnt btrfs fi sync /mnt btrfs replace start -B <missing devid> <devN> /mnt > _devmgt_remove <devN> # _devmgt_remove is helper for detaching scsi device > touch /mnt > btrfs fi sync /mnt > umount /mnt > > > I will try to make xfstest scripts for this case and for other cases > reported by me. > > -- > Yauhen Kharuzhy -- Yauhen Kharuzhy -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
