RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 993537 - readonly=on ignored by passthrough (scsi-block) disks
Summary: readonly=on ignored by passthrough (scsi-block) disks
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.5
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Paolo Bonzini
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 995415
TreeView+ depends on / blocked
 
Reported: 2013-08-06 06:59 UTC by langfang
Modified: 2015-03-23 17:57 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 995415 (view as bug list)
Environment:
Last Closed: 2015-03-23 17:57:55 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description langfang 2013-08-06 06:59:46 UTC
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 17:57:55 UTC
Deferred to RHEL7.


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