]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r327996: geom_disk / scsi_da: deny opening write-protected disks for writing
authoravg <avg@FreeBSD.org>
Thu, 15 Feb 2018 15:33:17 +0000 (15:33 +0000)
committeravg <avg@FreeBSD.org>
Thu, 15 Feb 2018 15:33:17 +0000 (15:33 +0000)
commitce658c8cd36d4134497a2805eb662f3e4615e8c2
tree03bbd3de25313b6bb55e8c1c3d4947c521b745e1
parenta580bc32859cbfaf1f2cf17d0964cc194b07630f
MFC r327996: geom_disk / scsi_da: deny opening write-protected disks for writing

Ths change consists of two parts.

geom_disk: deny opening a disk for writing if it's marked as
write-protected.  A new disk(9) flag is added to mark write protected
disks.  A possible alternative could be to add another parameter to d_open,
so that the open mode could be passed to it and the disk drivers could
make the decision internally, but the flag required less churn.

scsi_da: add a new phase of disk probing to query the all pages mode
sense page.  We can determine if the disk is write protected using bit 7
of the device specific field in the mode parameter header returned by
MODE SENSE.

PR: 224037
sys/cam/scsi/scsi_da.c
sys/geom/geom_disk.c
sys/geom/geom_disk.h