Bug 993537 - readonly=on ignored by passthrough (scsi-block) disks
readonly=on ignored by passthrough (scsi-block) disks
Status: CLOSED DEFERRED
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.5
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Paolo Bonzini
Virtualization Bugs
:
Depends On:
Blocks: 995415
  Show dependency treegraph
 
Reported: 2013-08-06 02:59 EDT by langfang
Modified: 2015-03-23 13:57 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 995415 (view as bug list)
Environment:
Last Closed: 2015-03-23 13:57:55 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description langfang 2013-08-06 02:59:46 EDT
Description of problem:

passthrough (scsi-block) disk with "readonly=on"  can be writed in guest.

Version-Release number of selected component (if applicable):
Host:
# uname -r
2.6.32-405.el6.x86_64
# rpm -q qemu-kvm
qemu-kvm-0.12.1.2-2.382.el6.x86_64
# rpm -q seabios
seabios-0.6.1.2-28.el6.x86_64
Guest:
2.6.32-403.el6.x86_64


How reproducible:

100%

Steps to Reproduce:
1.In host:
#fdisk -l
...
Disk /dev/sdb: 2147 MB, 2147483648 bytes
67 heads, 62 sectors/track, 1009 cylinders
Units = cylinders of 4154 * 512 = 2126848 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
...

2.Boot guest with "/dev/sdb"-->use iscsi
...-drive file=/dev/sdb,if=none,id=drive-data-disk,format=raw,werror=stop,rerror=stop,readonly=on -device scsi-block,drive=drive-data-disk,bus=scsi1.0,id=data-disk ...

2.After guest boot up,check and try format the disk 

In guest format the disk
#fdisk -l
...
Disk /dev/sdb: 2147 MB, 2147483648 bytes
67 heads, 62 sectors/track, 1009 cylinders
Units = cylinders of 4154 * 512 = 2126848 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
...


# mkfs.ext4 /dev/sdb
mke2fs 1.41.12 (17-May-2010)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
131072 inodes, 524288 blocks
26214 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912

Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: 
done

This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.


Actual results:
For a readonly disk can format and  create file

Expected results:

Can't write for the disk.

Additional info:

1)If i change "scsi-block" to "scsi-hd",not hit the problem

..drive file=/dev/sdb,if=none,id=drive-data-disk,format=raw,werror=stop,rerror=stop,readonly=on -device scsi-hd,drive=drive-data-disk,bus=scsi1.0,id=data-disk...

# mkfs.ext4 /dev/sdb
mke2fs 1.41.12 (17-May-2010)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
/dev/sdb: Read-only file system while setting up superblock

2)My CLI:
 /usr/libexec/qemu-kvm -m 4G -smp 4 -device virtio-scsi-pci,bus=pci.0,addr=0x5,id=scsi0 -drive file=/dev/vg-flang/lv-flang,if=none,id=drive-scsi0-0-0,media=disk,cache=none,format=raw,werror=stop,rerror=stop,aio=native -device scsi-hd,drive=drive-scsi0-0-0,bus=scsi0.0,scsi-id=0,lun=0,id=flang,bootindex=1 -monitor stdio -spice port=5830,disable-ticketing -vga qxl -device virtio-scsi-pci,bus=pci.0,addr=0x7,id=scsi1 -drive if=none,media=cdrom,format=raw,id=drive-ide1-0-0 -device scsi-cd,drive=drive-ide1-0-0,id=ide1-0-0,bus=scsi1.0 -qmp tcp:0:5555,server,nowait -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,mac=00:10:20:2d:31:22,bus=pci.0,addr=0x4,id=net0 -drive file=/home/floppy1,if=none,id=drive-fdc0-0-0,format=raw -global isa-fdc.driveA=drive-fdc0-0-0 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -serial unix:/tmp/tty1,server,nowait -drive file=/dev/sdb,if=none,id=drive-data-disk,format=raw,werror=stop,rerror=stop,readonly=on -device scsi-block,drive=drive-data-disk,bus=scsi1.0,id=data-disk -boot menu=on -monitor stdio
Comment 6 Paolo Bonzini 2015-03-23 13:57:55 EDT
Deferred to RHEL7.

Note You need to log in before you can comment on or make changes to this bug.