I have also noticed that bioctl reports the key disk as
incorrect. I initially thought it was my patch, but it seems to be wrong
whether or not my patch is applied. In fact the contents of the disk do
not change at all:

# bioctl softraid0
Volume      Status              Size Device
softraid0 0 Online       42197783040 sd3     CRYPTO
          0 Online       42197783040 0:0.0   noencl <sd0a>
softraid0 1 Online       33082493440 sd4     CRYPTO
          0 Online       33082493440 1:0.0   noencl <sd0e>
          1 Online          key disk 1:1.0   noencl <sd1e>
softraid0 2 Online       42199204864 sd5     CRYPTO
          0 Online       42199204864 2:0.0   noencl <sd0d>
          1 Online          key disk 2:1.0   noencl <sd2d>

The key disk I use is at sd1 for all volumes mounted (though the chunks
used [sdXa/sdXe/sdXd] are reported correctly).

Tested with the unpatched GENERIC and GENERIC.MP kernel (15/5/16), and
with the write-protect switch off.

I don't really understand why the "sdX" device name is embedded in the
key anyway, since this is likely to change as USB devices are plugged
in, etc. I would greatly appreciate advise/feedback from a dev involved
with softraid on that one.


Improved version of the patch, removes the VOP_CLOSE() that appears to
now be redundant:

Index: sys/dev/softraid_crypto.c
===================================================================
RCS file: /cvs/src/sys/dev/softraid_crypto.c,v
retrieving revision 1.126
diff -u -p -r1.126 softraid_crypto.c
--- sys/dev/softraid_crypto.c   12 Apr 2016 16:26:54 -0000
1.126 +++ sys/dev/softraid_crypto.c     17 May 2016 10:13:02 -0000
@@ -797,7 +797,7 @@ sr_crypto_read_key_disk(struct sr_discip
                sr_error(sc, "cannot open key disk %s", devname);
                goto done;
        }
-       if (VOP_OPEN(vn, FREAD | FWRITE, NOCRED, curproc)) {
+       if (VOP_OPEN(vn, FREAD, NOCRED, curproc)) {
                DNPRINTF(SR_D_META,"%s: sr_crypto_read_key_disk cannot
" "open %s\n", DEVNAME(sc), devname);
                vput(vn);
@@ -811,8 +811,6 @@ sr_crypto_read_key_disk(struct sr_discip
            NOCRED, curproc)) {
                DNPRINTF(SR_D_META, "%s: sr_crypto_read_key_disk ioctl
" "failed\n", DEVNAME(sc));
-               VOP_CLOSE(vn, FREAD | FWRITE, NOCRED, curproc);
-               vput(vn);
                goto done;
        }
        if (label.d_partitions[part].p_fstype != FS_RAID) {

Reply via email to