Softraid currently opens the key disk as read + write. This isn't necessary when just *reading* from the key disk.
This patch allows for softraid crypto to mount volumes with write-protected keydisks (eg. Kanguru Flash Blu: https://www.kanguru.com/storage-accessories/flash-blu30.shtml). Also tested volume creation with the Flash Blu write-protect switch off; still works as usual. 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 04:18:52 -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,7 +811,7 @@ 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); + VOP_CLOSE(vn, FREAD, NOCRED, curproc); vput(vn); goto done; }