From: Stefan Sperling Subject: Re: [patch] [ok?] bioctl: disallow -c 1C with only one chunk (as per man page) To: Alexander Klimov Cc: tech@openbsd.org Date: Fri, 26 Apr 2024 11:53:01 +0200 On Fri, Apr 26, 2024 at 11:12:18AM +0200, Alexander Klimov wrote: > Hello everyone! > > bioctl(8) clearly states that "The RAID 1C discipline > requires a minimum of two chunks when a new volume is created". > > However, bio_createraid() in /usr/src/sbin/bioctl/bioctl.c requires > only min_disks = 1; for 1C, allowing me a "bioctl -c 1C -l sdXY softraid0". > > Luckily the kernel complains with "softraid0: RAID 1C requires two or more chunks". > > The attached diff lets /sbin/bioctl complain with "bioctl: not enough disks". > Ok? Not ok, this was done on purpose. With your diff there is no way to recover from a broken chunk. > --- /usr/src/sbin/bioctl/bioctl.c > +++ /usr/src/sbin/bioctl/bioctl.c > @@ -857,8 +857,10 @@ > min_disks = 3; > break; > case 'C': > - case 0x1C: > min_disks = 1; > + break; > + case 0x1C: > + min_disks = 2; > break; > case 'c': > min_disks = 1;