Bug 47058

Summary: kernel get_last_block ioctl fails
Product: [Retired] Red Hat Linux Reporter: Matt Domsch <matt_domsch>
Component: kernelAssignee: Arjan van de Ven <arjanv>
Status: CLOSED RAWHIDE QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-07-11 16:51:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Matt Domsch 2001-07-02 20:24:08 UTC
Description of Problem:
On Fairfax, beta 1.
parted tries to read the last block of the disk via the get_last_sector 
ioctl, which is failing.  Looks like parted is fine, but the kernel 
implementation of get_last_sector is failing.

How Reproducible:
Always on aacraid (all I've tried so far).

Steps to Reproduce:
1. Run fairfax beta1 installer (I'm using FTP installs)
2. Choose to use Disk Druid for partitioning.  See screen gets screwed up 
with "read failed: Operation not permitted" messages.
3. Switch to VT4 and see:
 SCSI disk error: host 1 channel 0 id 0 lun 0 return code = 1
 I/O error: dev 08:00, sector 35542272
 get_last_sector ioctl: bread returned NULL.

Similarly, doing:
  mknod /dev/sda
  parted /dev/sda print
reproduces this quite easily. 

Actual Results:
Can't partition the disk.

Expected Results:
Can partition the disk.

Additional Information:
Looks like the get_last_block ioctl is getting called, but doesn't work 
for some reason.

Comment 1 Matt Domsch 2001-07-03 20:59:35 UTC
It's not a Linux bug.  I believe it to be a bug in the PERC 2/Si firmware.  A 
SCSI Read Capacity to a RAID10 logical drive with a 64K stripe size returns an 
odd number of sectors (in fact it's 64K*x+1).  That can't be right.  I'm 
pursuing this with Adaptec.
-Matt

Comment 2 Matt Domsch 2001-07-11 16:51:23 UTC
It's a bug in the aacraid driver which implements the READ CAPACITY command.  
Here's a patch which fixes it.  Arjan, please apply.

--- linux-2.4/drivers/scsi/aacraid/aachba.c~	Wed Jun 27 13:58:50 2001
+++ linux-2.4/drivers/scsi/aacraid/aachba.c	Tue Jul 10 18:57:01 2001
@@ -663,7 +663,7 @@
 			char *cp;
 
 			cmn_err( CE_DEBUG, "READ CAPACITY command" );
-			capacity = fsa_dev_ptr->ContainerSize[ContainerId];
+			capacity = fsa_dev_ptr->ContainerSize[ContainerId] - 1;
 			cp = scsi_cmnd_ptr->request_buffer;
 			cp[0] = ( capacity >> 24 ) & 0xff;
 			cp[1] = ( capacity >> 16 ) & 0xff;


Comment 3 Arjan van de Ven 2001-07-12 08:23:57 UTC
Added to tree