Bug 770548

Summary: RHEL4.9 HVM guest can write to a read-only SCSI disk
Product: Red Hat Enterprise Linux 4 Reporter: Yuyu Zhou <yuzhou>
Component: kernelAssignee: Red Hat Kernel Manager <kernel-mgr>
Status: CLOSED WONTFIX QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: low Docs Contact:
Priority: low    
Version: 4.9CC: jzheng, leiwang, lersek, mrezanin, qguan, qwan, shwang, xen-maint, yuzhou
Target Milestone: rc   
Target Release: 4.9   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 13:31:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
guest dmesg log none

Description Yuyu Zhou 2011-12-27 11:31:41 UTC
Description of problem:
RHEL4.9 HVM guest can write to a read-only SCSI disk although the read-only "r" flag is set in guest configure. And tons of the error message show up after the file operation, as following:
SCSI error : <0 0 0 0> return code = 0x8000002
Info fld=0x0, Current sda: sense key Hardware Error
end_request: I/O error, dev sda, sector 63
Buffer I/O error on device sda1, logical block 0
lost page write due to I/O error on sda1

Version-Release number of selected component (if applicable):
host: kernel-xen-2.6.18-302.el5, xen-3.0.3-135.el5
guest: RHEL4U9 RC, kernel-2.6.9-100.EL

How reproducible:
100%

Steps to Reproduce:
1. Start a RHEL4U9 HVM guest with follow disk parameter:
disk = ["file:/data/exp/images/RHEL-4.9-32-hvm.raw,hda,w","file:/data/exp/images/raw.img,sdb,r"]
make sure the raw.img is partitioned before and has a file system inside.
2. Check the disk status by fdisk in guest, and mount the SCSI disk to a empty directory.
3. Create a new file in the read-only disk or try to remove a file from the read-only disk
4. Destroy the guest and recreate it again.
 
Actual results:
1. At step 2, the first error message shows up:
SCSI error : <0 0 0 0> return code = 0x8000002
Info fld=0x0, Current sda: sense key Hardware Error
end_request: I/O error, dev sda, sector 63
Buffer I/O error on device sda1, logical block 0
lost page write due to I/O error on sda1
2. At step3, it seems the file operation succeed in guest and tons of error messages show up.
3. After step4, the read-only disk seems not touched. The created file in step 3 does not exist, and the deleted file in step 4 is still there.

Expected results:
1. At step 2, a proper read-only warning message shows up rather than the error message.
2. At step 3, the file operation should fail with proper message.

Additional info:
1. guest dmesg log attached.
2. The writeable SCSI disk works fine in RHEL4.9 guest.
3. The read-only SCSI disk works fine in RHEL5.8 guest.
4. if use following command to change the content of an unformatted read-only scsi disk, you will find the content of read-only SCSI disk is not changed.
#dd if=/dev/hda of=/dev/sda bs=1M count=1
#od -x /dev/sda1 -N 512

Comment 1 Yuyu Zhou 2011-12-27 11:32:24 UTC
Created attachment 549676 [details]
guest dmesg log

Comment 3 Miroslav Rezanina 2012-01-18 07:00:15 UTC
This is problem of guest kernel that is not aware of scsi read-only state.

Comment 4 Laszlo Ersek 2012-01-30 15:26:58 UTC
Changing component to "kernel". 

The guest kernel is a bare-metal kernel. The disk is an emulated (ie. not paravirt / PV-on-HVM) QEMU disk, so the guest-side driver is the "normal" scsi driver. The host side emulation (qemu-dm) works correctly, as per comment 0 / additional info / 3.

Comment 5 Jiri Pallich 2012-06-20 13:31:11 UTC
Thank you for submitting this issue for consideration in Red Hat Enterprise Linux. The release for which you requested us to review is now End of Life. 
Please See https://access.redhat.com/support/policy/updates/errata/

If you would like Red Hat to re-consider your feature request for an active release, please re-open the request via appropriate support channels and provide additional supporting details about the importance of this issue.