Date: Thu, 26 Nov 2015 23:58:17 +0100 From: Michael van Elst <mlel...@serpens.de> Message-ID: <20151126225816.gb...@serpens.de>
| On Thu, Nov 26, 2015 at 06:29:30PM +0700, Robert Elz wrote: | | > Just try making a ccd by combining a 512 byte sector drive and a 4K | > sector drive, and watch what happens... | | CCD is a very old device that isn't even configured "correctly" and | I would be very surprised if it could concat drives of different sector | sizes. It can't. Or rather, it tries, or permits it anyway, and makes a real mess. | After all, what fake geometry should it present to the user? That at least is easy - it must present the more restricted geom, if any of the components has 4K sectors (and the others are all <= 4k) then it must present as a 4K sector size device. That's simple, and would be easy to get right, if ccd was really worth continuing with. | Yes, CGD is broken. Looks like a simple fix. The simple fix would be do do what you suggested for lvm, and just make it appear to have 512 byte sectors, with N * the number of sectors it really has from the device (for a 4K sector drive, multiply the number of sectors by 8). I have no doubt that would kind of function, but again it would make the cgd "drive" appear to be able to handle 512 byte reads and writes, which it cannot, because the hardware underneath cannot. Fixing it to present 4K sectors also looks easy, but isn't. Doing that causes a panic somewhere when the cgd is attempting to validate the label (bsd disklabel) that gets written to it to allow it to be partitioned (one day it would be nice for cgd to allow GPT labels, and handle them for validation of the encryption, but that isn't there yet.) Something in the label handling code is (I think - or guess) translating units incorrectly, and failing. Here's the traceback I got ... vpanic() at vpanic+0x140 snprintf() at snprintf startlwp() at startlwp calltrap() at calltrap+0x19 bf_cbc_dec_int() at bf_cbc_dec_int+0x27 cgd_cipher_uio_cbc.isra.0() at cgd_cipher_uio_cbc.isra.0+0x79 cgd_cipher_bf_cbc() at cgd_cipher_bf_cbc+0x8d cgd_cipher() at cgd_cipher+0x16a cgdiodone() at cgdiodone+0xaf biodone2() at biodone2+0x89 dkiodone() at dkiodone+0x84 biodone2() at biodone2+0x89 bdev_strategy() at bdev_strategy+0x5b spec_strategy() at spec_strategy+0x37 VOP_STRATEGY() at VOP_STRATEGY+0x33 dkstart() at dkstart+0x2b dkstrategy() at dkstrategy+0xd5 bdev_strategy() at bdev_strategy+0x5b spec_strategy() at spec_strategy+0x37 VOP_STRATEGY() at VOP_STRATEGY+0x33 cgd_diskstart() at cgd_diskstart+0xb7 dk_start() at dk_start+0x9b disk_read_sectors() at disk_read_sectors+0x3b convertdisklabel() at convertdisklabel+0xf0 validate_label() at validate_label+0x14c readdisklabel() at readdisklabel+0x1c8 dk_getdisklabel() at dk_getdisklabel+0xbf dk_open() at dk_open+0xf4 cdev_open() at cdev_open+0xb2 spec_open() at spec_open+0x25d VOP_OPEN() at VOP_OPEN+0x33 vn_open() at vn_open+0x1e3 do_open() at do_open+0x111 do_sys_openat() at do_sys_openat+0x68 sys_open() at sys_open+0x24 syscall() at syscall+0x9c --- syscall (number 5) --- kre