Bug 16058 - [BUG] Cannot boot any kernel from 2.6.27 on if a 256 byte sector SCSI disk is attached
Summary: [BUG] Cannot boot any kernel from 2.6.27 on if a 256 byte sector SCSI disk is...
Status: REOPENED
Alias: None
Product: SCSI Drivers
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: scsi_drivers-other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-27 15:22 UTC by Mark Hounschell
Modified: 2015-05-12 13:46 UTC (History)
3 users (show)

See Also:
Kernel Version: 4.0.2
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments
The boot process captured from a serial console (44.96 KB, text/plain)
2010-05-27 15:22 UTC, Mark Hounschell
Details
make scsi disk 256 byte sector unsupported for linux filesystems (1.55 KB, patch)
2015-05-12 13:44 UTC, Mark Hounschell
Details | Diff

Description Mark Hounschell 2010-05-27 15:22:06 UTC
Created attachment 26560 [details]
The boot process captured from a serial console

As of 2.6.27 if any SCSI disk is attached that has been formatted with a 256 byte sector size, the boot process hangs. 512, 768, and 1024 byte sector disks do not seem to trigger this. The disks in use do NOT have a partition table. They are being used by out applications via the sg_io interface only.

A 2.6.26.8 kernel works fine. 

I have bisected this problem to the following commit:

# git bisect good
427e59f09fdba387547106de7bab980b7fff77be is first bad commit
commit 427e59f09fdba387547106de7bab980b7fff77be
Author: James Bottomley <James.Bottomley@HansenPartnership.com>
Date:   Sat Mar 8 18:24:17 2008 -0600

    [SCSI] make use of the residue value

    USB sometimes doesn't return an error but instead returns a residue
    value indicating part (or all) of the command wasn't completed.  So if
    the driver _done() error processing indicates the command was fully
    processed, subtract off the residue so that this USB error gets
    propagated.

    Cc: Alan Stern <stern@rowland.harvard.edu>
    Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

:040000 040000 d3bad84ebe1bc231e8e7d6267907ca62fd4d0dcd
c85f8cb8bd4910724f0101e41054555980727e16 M      drivers

Now, what USB has to do with my SCSI disks is beyond me. I have a
feeling that this commit is just uncovering another problem. I've attached
a bootlog from a serial console that ends where the boot hangs.

The does the same thing on a 2.6.34 kernel. Anything I can do to help, I'm available.

Thanks and regards
Mark
Comment 1 Alan Stern 2010-05-27 20:31:16 UTC
On Thu, 27 May 2010, Andrew Morton wrote:

> https://bugzilla.kernel.org/show_bug.cgi?id=16058
> 
>            Summary: [BUG] Cannot boot any kernel from 2.6.27 on if a 256
>                     byte sector SCSI disk is attached

> As of 2.6.27 if any SCSI disk is attached that has been formatted with a 256
> byte sector size, the boot process hangs. 512, 768, and 1024 byte sector
> disks
> do not seem to trigger this. The disks in use do NOT have a partition table.
> They are being used by out applications via the sg_io interface only.
> 
> A 2.6.26.8 kernel works fine. 
> 
> I have bisected this problem to the following commit:
> 
> # git bisect good
> 427e59f09fdba387547106de7bab980b7fff77be is first bad commit
> commit 427e59f09fdba387547106de7bab980b7fff77be
> Author: James Bottomley <James.Bottomley@HansenPartnership.com>
> Date:   Sat Mar 8 18:24:17 2008 -0600
> 
>     [SCSI] make use of the residue value
> 
>     USB sometimes doesn't return an error but instead returns a residue
>     value indicating part (or all) of the command wasn't completed.  So if
>     the driver _done() error processing indicates the command was fully
>     processed, subtract off the residue so that this USB error gets
>     propagated.
> 
>     Cc: Alan Stern <stern@rowland.harvard.edu>
>     Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
> 
> :040000 040000 d3bad84ebe1bc231e8e7d6267907ca62fd4d0dcd
> c85f8cb8bd4910724f0101e41054555980727e16 M      drivers
> 
> Now, what USB has to do with my SCSI disks is beyond me. I have a
> feeling that this commit is just uncovering another problem. I've attached
> a bootlog from a serial console that ends where the boot hangs.
> 
> The does the same thing on a 2.6.34 kernel. Anything I can do to help, I'm
> available.

I'd guess that this has nothing to do with the sector size.  Instead
the drive probably reports a non-zero residue when it shouldn't.  Can
you add some debugging printk's to the patch to find out in more detail
what's going wrong?

Alan Stern
Comment 2 Alan Stern 2010-05-27 21:18:37 UTC
On Thu, 27 May 2010, Mark Hounschell wrote:

> >> As of 2.6.27 if any SCSI disk is attached that has been formatted with a
> 256
> >> byte sector size, the boot process hangs. 512, 768, and 1024 byte sector
> disks

> >> The does the same thing on a 2.6.34 kernel. Anything I can do to help, I'm
> >> available.

> Yes, I can. But first let me ask, since reverting this patch on at least
> 2.6.32 - 2.6.34 does not help, would it possibly be better if I did a
> little more work to find out where it stops working with the above patch
> reverted or not?

I'd do 2.6.27 first, since that's where the problem started.  Then move 
on to 2.6.34.  There may be two different problems.

Alan Stern
Comment 3 Mark Hounschell 2010-05-27 22:05:35 UTC
On 05/27/2010 04:30 PM, Alan Stern wrote:
> On Thu, 27 May 2010, Andrew Morton wrote:
> 
>> https://bugzilla.kernel.org/show_bug.cgi?id=16058
>>
>>            Summary: [BUG] Cannot boot any kernel from 2.6.27 on if a 256
>>                     byte sector SCSI disk is attached
> 
>> As of 2.6.27 if any SCSI disk is attached that has been formatted with a 256
>> byte sector size, the boot process hangs. 512, 768, and 1024 byte sector
>> disks
>> do not seem to trigger this. The disks in use do NOT have a partition table.
>> They are being used by out applications via the sg_io interface only.
>>
>> A 2.6.26.8 kernel works fine. 
>>
>> I have bisected this problem to the following commit:
>>
>> # git bisect good
>> 427e59f09fdba387547106de7bab980b7fff77be is first bad commit
>> commit 427e59f09fdba387547106de7bab980b7fff77be
>> Author: James Bottomley <James.Bottomley@HansenPartnership.com>
>> Date:   Sat Mar 8 18:24:17 2008 -0600
>>
>>     [SCSI] make use of the residue value
>>
>>     USB sometimes doesn't return an error but instead returns a residue
>>     value indicating part (or all) of the command wasn't completed.  So if
>>     the driver _done() error processing indicates the command was fully
>>     processed, subtract off the residue so that this USB error gets
>>     propagated.
>>
>>     Cc: Alan Stern <stern@rowland.harvard.edu>
>>     Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
>>
>> :040000 040000 d3bad84ebe1bc231e8e7d6267907ca62fd4d0dcd
>> c85f8cb8bd4910724f0101e41054555980727e16 M      drivers
>>
>> Now, what USB has to do with my SCSI disks is beyond me. I have a
>> feeling that this commit is just uncovering another problem. I've attached
>> a bootlog from a serial console that ends where the boot hangs.
>>
>> The does the same thing on a 2.6.34 kernel. Anything I can do to help, I'm
>> available.
> 
> I'd guess that this has nothing to do with the sector size.  Instead
> the drive probably reports a non-zero residue when it shouldn't.  Can
> you add some debugging printk's to the patch to find out in more detail
> what's going wrong?
> 
> Alan Stern
> 
> 

Yes, I can. But first let me ask, since reverting this patch on at least
2.6.32 - 2.6.34 does not help, would it possibly be better if I did a
little more work to find out where it stops working with the above patch
reverted or not?

Mark
Comment 4 Alan Stern 2010-05-28 14:58:55 UTC
On Fri, 28 May 2010, Mark Hounschell wrote:

> First READ(10):
> 
>  sde:
> ahc_calc_residual: Entered
> ahc_calc_residual: return Case 5-1 resid = 0x800
> ahc_calc_residual: return Case 5-2 resid = 0x800
> 
> scsi_finish_command: Entered for cmd(10):0x28 0x00 0x00 0x00 0x00 0x00
> 0x00 0x00 0x08 0x00
> cmd->result = 0x00000000
> good_bytes == old_good_bytes = 0x800  scsi_get_resid(cmd) = 0x800
> New good_bytes = 0x0
> scsi_finish_command: Complete
> 
> From here it just keeps repeating this read of 8 blocks. (2048 bytes) so
> it looks like the machine is hung.

Probably not hung, just doing a lot of retries.  It should time out 
eventually, but it might take a long time (perhaps as long as 15 
minutes).  The combination of the block layer and the SCSI layer isn't 
very good at knowing when to give up.

> Now, I know for a fact that _if_ this read CDB is actually being sent to
> the drive, it's actual residual count will be zero. These are working
> disks and that read CDB is valid.
> 
> Why is ahc_calc_residual saying that the residual count is as though the
> read never took place? I noticed that the first read on all the SATA
> drives was for 4096 bytes, why is this one only 2048? Should it have
> been 4096 and ahc_calc_residual assume that?

I don't know the answer to any of these questions.  They could well be
due to bugs in the driver, and I know nothing about how the aic7xxx
driver works.  You should talk to someone who does.

In the meantime, you can track this down a little farther by adding
printk's to the appropriate places in drivers/scsi/sd.c.  Look at
sd_prep_fn() to see why there's 2048 bytes instead of 4096.

Alan Stern
Comment 5 Mark Hounschell 2010-05-28 15:42:40 UTC
On 05/27/2010 04:30 PM, Alan Stern wrote:
> On Thu, 27 May 2010, Andrew Morton wrote:
>
>   
>> https://bugzilla.kernel.org/show_bug.cgi?id=16058
>>
>>            Summary: [BUG] Cannot boot any kernel from 2.6.27 on if a 256
>>                     byte sector SCSI disk is attached
>>     
>   
>> As of 2.6.27 if any SCSI disk is attached that has been formatted with a 256
>> byte sector size, the boot process hangs. 512, 768, and 1024 byte sector
>> disks
>> do not seem to trigger this. The disks in use do NOT have a partition table.
>> They are being used by out applications via the sg_io interface only.
>>
>> A 2.6.26.8 kernel works fine. 
>>
>> I have bisected this problem to the following commit:
>>
>> # git bisect good
>> 427e59f09fdba387547106de7bab980b7fff77be is first bad commit
>> commit 427e59f09fdba387547106de7bab980b7fff77be
>> Author: James Bottomley <James.Bottomley@HansenPartnership.com>
>> Date:   Sat Mar 8 18:24:17 2008 -0600
>>
>>     [SCSI] make use of the residue value
>>
>>     USB sometimes doesn't return an error but instead returns a residue
>>     value indicating part (or all) of the command wasn't completed.  So if
>>     the driver _done() error processing indicates the command was fully
>>     processed, subtract off the residue so that this USB error gets
>>     propagated.
>>
>>     Cc: Alan Stern <stern@rowland.harvard.edu>
>>     Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
>>
>> :040000 040000 d3bad84ebe1bc231e8e7d6267907ca62fd4d0dcd
>> c85f8cb8bd4910724f0101e41054555980727e16 M      drivers
>>
>> Now, what USB has to do with my SCSI disks is beyond me. I have a
>> feeling that this commit is just uncovering another problem. I've attached
>> a bootlog from a serial console that ends where the boot hangs.
>>
>> The does the same thing on a 2.6.34 kernel. Anything I can do to help, I'm
>> available.
>>     
> I'd guess that this has nothing to do with the sector size.  Instead
> the drive probably reports a non-zero residue when it shouldn't.  Can
> you add some debugging printk's to the patch to find out in more detail
> what's going wrong?
>
> Alan Stern
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>   
Alan,

I've added some printks in scsi.c and aic7xxx_core.c.

A TUR:

ahc_calc_residual: Entered
ahc_calc_residual: return Case 2 sgptr = 0x00000001

ahc_calc_residual: Entered
ahc_calc_residual: return Case 5-1 resid = 0xe
ahc_calc_residual: return Case 5-2 resid = 0xe

scsi_finish_command: Entered for cmd(6):0x00 0x00 0x00 0x00 0x00 0x00
cmd->result = 0x08000002
good_bytes = 0x0
scsi_finish_command: Complete


Another TUR:

scsi_finish_command: Entered for cmd(6):0x00 0x00 0x00 0x00 0x00 0x00
cmd->result = 0x00000000
good_bytes = 0x0
scsi_finish_command: Complete


A Read Capicity:

scsi_finish_command: Entered for cmd(10):0x25 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00
cmd->result = 0x00000000
good_bytes = 0x8
scsi_finish_command: Complete

sd 8:0:0:0: [sde] 7260582 256-byte hardware sectors (1859 MB)


A Mode Sense:

scsi_finish_command: Entered for cmd(6):0x1a 0x00 0x3f 0x00 0x04 0x00
cmd->result = 0x00000000
good_bytes = 0x4
scsi_finish_command: Complete

sd 8:0:0:0: [sde] Write Protect is off


Another Mode Sense:

scsi_finish_command: Entered for cmd(6):0x1a 0x00 0x08 0x00 0x04 0x00
cmd->result = 0x00000000
good_bytes = 0x4
scsi_finish_command: Complete


Another Mode Sense:

ahc_calc_residual: Entered
ahc_calc_residual: return Case 5-1 resid = 0x8
ahc_calc_residual: return Case 5-2 resid = 0x8

scsi_finish_command: Entered for cmd(6):0x1a 0x00 0x08 0x00 0x20 0x00
cmd->result = 0x00000000
good_bytes = 0x20
scsi_finish_command: Complete

sd 8:0:0:0: [sde] Write cache: disabled, read cache: enabled, supports
DPO and FUA


Another TUR:

scsi_finish_command: Entered for cmd(6):0x00 0x00 0x00 0x00 0x00 0x00
cmd->result = 0x00000000
good_bytes = 0x0
scsi_finish_command: Complete


Another Read Capacity:

scsi_finish_command: Entered for cmd(10):0x25 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00
cmd->result = 0x00000000
good_bytes = 0x8
scsi_finish_command: Complete

sd 8:0:0:0: [sde] 7260582 256-byte hardware sectors (1859 MB)


Another Mode Sense:

scsi_finish_command: Entered for cmd(6):0x1a 0x00 0x3f 0x00 0x04 0x00
cmd->result = 0x00000000
good_bytes = 0x4
scsi_finish_command: Complete

sd 8:0:0:0: [sde] Write Protect is off


Another Mode Sense:

scsi_finish_command: Entered for cmd(6):0x1a 0x00 0x08 0x00 0x04 0x00
cmd->result = 0x00000000
good_bytes = 0x4
scsi_finish_command: Complete


Another Mode Sense:

ahc_calc_residual: Entered
ahc_calc_residual: return Case 5-1 resid = 0x8
ahc_calc_residual: return Case 5-2 resid = 0x8

scsi_finish_command: Entered for cmd(6):0x1a 0x00 0x08 0x00 0x20 0x00
cmd->result = 0x00000000
good_bytes = 0x20
scsi_finish_command: Complete

sd 8:0:0:0: [sde] Write cache: disabled, read cache: enabled, supports
DPO and FUA


Another TUR:

scsi_finish_command: Entered for cmd(6):0x00 0x00 0x00 0x00 0x00 0x00
cmd->result = 0x00000000
good_bytes = 0x0
scsi_finish_command: Complete


Another Read Capacity:

scsi_finish_command: Entered for cmd(10):0x25 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00
cmd->result = 0x00000000
good_bytes = 0x8
scsi_finish_command: Complete

sd 8:0:0:0: [sde] 7260582 256-byte hardware sectors (1859 MB)


Another Mode Sense:

scsi_finish_command: Entered for cmd(6):0x1a 0x00 0x3f 0x00 0x04 0x00
cmd->result = 0x00000000
good_bytes = 0x4
scsi_finish_command: Complete

sd 8:0:0:0: [sde] Write Protect is off


Another Mode Sense:

scsi_finish_command: Entered for cmd(6):0x1a 0x00 0x08 0x00 0x04 0x00
cmd->result = 0x00000000
good_bytes = 0x4
scsi_finish_command: Complete


Another Mode Sense:

ahc_calc_residual: Entered
ahc_calc_residual: return Case 5-1 resid = 0x8
ahc_calc_residual: return Case 5-2 resid = 0x8

scsi_finish_command: Entered for cmd(6):0x1a 0x00 0x08 0x00 0x20 0x00
cmd->result = 0x00000000
good_bytes = 0x20
scsi_finish_command: Complete

sd 8:0:0:0: [sde] Write cache: disabled, read cache: enabled, supports
DPO and FUA


First READ(10):

 sde:
ahc_calc_residual: Entered
ahc_calc_residual: return Case 5-1 resid = 0x800
ahc_calc_residual: return Case 5-2 resid = 0x800

scsi_finish_command: Entered for cmd(10):0x28 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x08 0x00
cmd->result = 0x00000000
good_bytes == old_good_bytes = 0x800  scsi_get_resid(cmd) = 0x800
New good_bytes = 0x0
scsi_finish_command: Complete

From here it just keeps repeating this read of 8 blocks. (2048 bytes) so
it looks like the machine is hung.

Now, I know for a fact that _if_ this read CDB is actually being sent to
the drive, it's actual residual count will be zero. These are working
disks and that read CDB is valid.

Why is ahc_calc_residual saying that the residual count is as though the
read never took place? I noticed that the first read on all the SATA
drives was for 4096 bytes, why is this one only 2048? Should it have
been 4096 and ahc_calc_residual assume that?

BTW, I'll be in and out all day today so I may not be able to respond
quickly.

One thing all these machines I have doing this, have in common, is the
scsi controller (Aic7xxx).

Regards
Mark
Comment 6 Anonymous Emailer 2010-05-28 16:34:28 UTC
Reply-To: James.Bottomley@suse.de

On Fri, 2010-05-28 at 10:58 -0400, Alan Stern wrote:
> On Fri, 28 May 2010, Mark Hounschell wrote:
> 
> > First READ(10):
> > 
> >  sde:
> > ahc_calc_residual: Entered
> > ahc_calc_residual: return Case 5-1 resid = 0x800
> > ahc_calc_residual: return Case 5-2 resid = 0x800
> > 
> > scsi_finish_command: Entered for cmd(10):0x28 0x00 0x00 0x00 0x00 0x00
> > 0x00 0x00 0x08 0x00
> > cmd->result = 0x00000000
> > good_bytes == old_good_bytes = 0x800  scsi_get_resid(cmd) = 0x800
> > New good_bytes = 0x0
> > scsi_finish_command: Complete
> > 
> > From here it just keeps repeating this read of 8 blocks. (2048 bytes) so
> > it looks like the machine is hung.
> 
> Probably not hung, just doing a lot of retries.  It should time out 
> eventually, but it might take a long time (perhaps as long as 15 
> minutes).  The combination of the block layer and the SCSI layer isn't 
> very good at knowing when to give up.

Actually, I think this is a partition read.  Each partition manager
tends to read a page through the page cache.  If we get an error, we
seem to re-read to fill the cache.

> > Now, I know for a fact that _if_ this read CDB is actually being sent to
> > the drive, it's actual residual count will be zero. These are working
> > disks and that read CDB is valid.
> > 
> > Why is ahc_calc_residual saying that the residual count is as though the
> > read never took place? I noticed that the first read on all the SATA
> > drives was for 4096 bytes, why is this one only 2048? Should it have
> > been 4096 and ahc_calc_residual assume that?
> 
> I don't know the answer to any of these questions.  They could well be
> due to bugs in the driver, and I know nothing about how the aic7xxx
> driver works.  You should talk to someone who does.

I'll take this one ... although we're a bit lacking in documentation for
this driver.

I think the 2048 is because something is hardcoded to think 8 sectors is
a page.

James
Comment 7 Mark Hounschell 2010-05-28 19:30:11 UTC
On 05/28/2010 12:34 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=16058
>
>
>
>
>
> --- Comment #6 from Anonymous Emailer <anonymous@kernel-bugs.osdl.org> 
> 2010-05-28 16:34:28 ---
> Reply-To: James.Bottomley@suse.de
>
> On Fri, 2010-05-28 at 10:58 -0400, Alan Stern wrote:
>   
>> On Fri, 28 May 2010, Mark Hounschell wrote:
>>
>>     
>>> First READ(10):
>>>
>>>  sde:
>>> ahc_calc_residual: Entered
>>> ahc_calc_residual: return Case 5-1 resid = 0x800
>>> ahc_calc_residual: return Case 5-2 resid = 0x800
>>>
>>> scsi_finish_command: Entered for cmd(10):0x28 0x00 0x00 0x00 0x00 0x00
>>> 0x00 0x00 0x08 0x00
>>> cmd->result = 0x00000000
>>> good_bytes == old_good_bytes = 0x800  scsi_get_resid(cmd) = 0x800
>>> New good_bytes = 0x0
>>> scsi_finish_command: Complete
>>>
>>> From here it just keeps repeating this read of 8 blocks. (2048 bytes) so
>>> it looks like the machine is hung.
>>>       
>> Probably not hung, just doing a lot of retries.  It should time out 
>> eventually, but it might take a long time (perhaps as long as 15 
>> minutes).  The combination of the block layer and the SCSI layer isn't 
>> very good at knowing when to give up.
>>     
> Actually, I think this is a partition read.  Each partition manager
> tends to read a page through the page cache.  If we get an error, we
> seem to re-read to fill the cache.
>
>   
>>> Now, I know for a fact that _if_ this read CDB is actually being sent to
>>> the drive, it's actual residual count will be zero. These are working
>>> disks and that read CDB is valid.
>>>
>>> Why is ahc_calc_residual saying that the residual count is as though the
>>> read never took place? I noticed that the first read on all the SATA
>>> drives was for 4096 bytes, why is this one only 2048? Should it have
>>> been 4096 and ahc_calc_residual assume that?
>>>       
>> I don't know the answer to any of these questions.  They could well be
>> due to bugs in the driver, and I know nothing about how the aic7xxx
>> driver works.  You should talk to someone who does.
>>     
> I'll take this one ... although we're a bit lacking in documentation for
> this driver.
>
> I think the 2048 is because something is hardcoded to think 8 sectors is
> a page.
>
> James
>
>   
Your probably right. But is a 256 byte sector really a supported sector
size for a linux fs on a SCSI disk? When it sees a 768 byte sector disk,
it says it's an unsupported size and goes on with the boot process
without even doing a read for a partition table. Should maybe it be
doing the same for a 256 byte sector disk???

Regards
Mark
Comment 8 Anonymous Emailer 2010-05-28 20:26:28 UTC
Reply-To: James.Bottomley@suse.de

On Fri, 2010-05-28 at 15:29 -0400, Mark Hounschell wrote:
> On 05/28/2010 12:34 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=16058
> >
> >
> >
> >
> >
> > --- Comment #6 from Anonymous Emailer <anonymous@kernel-bugs.osdl.org> 
> 2010-05-28 16:34:28 ---
> > Reply-To: James.Bottomley@suse.de
> >
> > On Fri, 2010-05-28 at 10:58 -0400, Alan Stern wrote:
> >   
> >> On Fri, 28 May 2010, Mark Hounschell wrote:
> >>
> >>     
> >>> First READ(10):
> >>>
> >>>  sde:
> >>> ahc_calc_residual: Entered
> >>> ahc_calc_residual: return Case 5-1 resid = 0x800
> >>> ahc_calc_residual: return Case 5-2 resid = 0x800
> >>>
> >>> scsi_finish_command: Entered for cmd(10):0x28 0x00 0x00 0x00 0x00 0x00
> >>> 0x00 0x00 0x08 0x00
> >>> cmd->result = 0x00000000
> >>> good_bytes == old_good_bytes = 0x800  scsi_get_resid(cmd) = 0x800
> >>> New good_bytes = 0x0
> >>> scsi_finish_command: Complete
> >>>
> >>> From here it just keeps repeating this read of 8 blocks. (2048 bytes) so
> >>> it looks like the machine is hung.
> >>>       
> >> Probably not hung, just doing a lot of retries.  It should time out 
> >> eventually, but it might take a long time (perhaps as long as 15 
> >> minutes).  The combination of the block layer and the SCSI layer isn't 
> >> very good at knowing when to give up.
> >>     
> > Actually, I think this is a partition read.  Each partition manager
> > tends to read a page through the page cache.  If we get an error, we
> > seem to re-read to fill the cache.
> >
> >   
> >>> Now, I know for a fact that _if_ this read CDB is actually being sent to
> >>> the drive, it's actual residual count will be zero. These are working
> >>> disks and that read CDB is valid.
> >>>
> >>> Why is ahc_calc_residual saying that the residual count is as though the
> >>> read never took place? I noticed that the first read on all the SATA
> >>> drives was for 4096 bytes, why is this one only 2048? Should it have
> >>> been 4096 and ahc_calc_residual assume that?
> >>>       
> >> I don't know the answer to any of these questions.  They could well be
> >> due to bugs in the driver, and I know nothing about how the aic7xxx
> >> driver works.  You should talk to someone who does.
> >>     
> > I'll take this one ... although we're a bit lacking in documentation for
> > this driver.
> >
> > I think the 2048 is because something is hardcoded to think 8 sectors is
> > a page.
> >
> > James
> >
> >   
> Your probably right. But is a 256 byte sector really a supported sector
> size for a linux fs on a SCSI disk?

In theory the block layer can support any power of two sector size (or
really any sector size which is a divisor of the page size).  We had a
use for 256 byte sectors once, so they're in SCSI.  In practice, since
they're so rare, the code paths are never tested (as you found out) and
there's a more annoying problem which is since the linux base sector
size is 512, you have to multiply to get from 256 to 512 ... for all
other sector sizes you have to divide, so any conversion routine that
only right shifts would get this wrong.

>  When it sees a 768 byte sector disk,
> it says it's an unsupported size and goes on with the boot process
> without even doing a read for a partition table.

that's because 768 isn't a power of 2, so it's completely unsupportable.

>  Should maybe it be
> doing the same for a 256 byte sector disk???

Possibly ... I don't know what the 256 byte sector support was for ...
all I know is that whatever it was, I don't have one.

James
Comment 9 Mark Hounschell 2010-05-30 11:51:53 UTC
On 05/28/2010 04:25 PM, James Bottomley wrote:
> On Fri, 2010-05-28 at 15:29 -0400, Mark Hounschell wrote:
>   
>> On 05/28/2010 12:34 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
>>     
>>> https://bugzilla.kernel.org/show_bug.cgi?id=16058
>>>
>>>
>>>
>>>
>>>
>>> --- Comment #6 from Anonymous Emailer <anonymous@kernel-bugs.osdl.org> 
>>> 2010-05-28 16:34:28 ---
>>> Reply-To: James.Bottomley@suse.de
>>>
>>> On Fri, 2010-05-28 at 10:58 -0400, Alan Stern wrote:
>>>   
>>>       
>>>> On Fri, 28 May 2010, Mark Hounschell wrote:
>>>>
>>>>     
>>>>         
>>>>> First READ(10):
>>>>>
>>>>>  sde:
>>>>> ahc_calc_residual: Entered
>>>>> ahc_calc_residual: return Case 5-1 resid = 0x800
>>>>> ahc_calc_residual: return Case 5-2 resid = 0x800
>>>>>
>>>>> scsi_finish_command: Entered for cmd(10):0x28 0x00 0x00 0x00 0x00 0x00
>>>>> 0x00 0x00 0x08 0x00
>>>>> cmd->result = 0x00000000
>>>>> good_bytes == old_good_bytes = 0x800  scsi_get_resid(cmd) = 0x800
>>>>> New good_bytes = 0x0
>>>>> scsi_finish_command: Complete
>>>>>
>>>>> From here it just keeps repeating this read of 8 blocks. (2048 bytes) so
>>>>> it looks like the machine is hung.
>>>>>       
>>>>>           
>>>> Probably not hung, just doing a lot of retries.  It should time out 
>>>> eventually, but it might take a long time (perhaps as long as 15 
>>>> minutes).  The combination of the block layer and the SCSI layer isn't 
>>>> very good at knowing when to give up.
>>>>     
>>>>         
>>> Actually, I think this is a partition read.  Each partition manager
>>> tends to read a page through the page cache.  If we get an error, we
>>> seem to re-read to fill the cache.
>>>
>>>   
>>>       
>>>>> Now, I know for a fact that _if_ this read CDB is actually being sent to
>>>>> the drive, it's actual residual count will be zero. These are working
>>>>> disks and that read CDB is valid.
>>>>>
>>>>> Why is ahc_calc_residual saying that the residual count is as though the
>>>>> read never took place? I noticed that the first read on all the SATA
>>>>> drives was for 4096 bytes, why is this one only 2048? Should it have
>>>>> been 4096 and ahc_calc_residual assume that?
>>>>>       
>>>>>           
>>>> I don't know the answer to any of these questions.  They could well be
>>>> due to bugs in the driver, and I know nothing about how the aic7xxx
>>>> driver works.  You should talk to someone who does.
>>>>     
>>>>         
>>> I'll take this one ... although we're a bit lacking in documentation for
>>> this driver.
>>>
>>> I think the 2048 is because something is hardcoded to think 8 sectors is
>>> a page.
>>>
>>> James
>>>
>>>   
>>>       
>> Your probably right. But is a 256 byte sector really a supported sector
>> size for a linux fs on a SCSI disk?
>>     
> In theory the block layer can support any power of two sector size (or
> really any sector size which is a divisor of the page size).  We had a
> use for 256 byte sectors once, so they're in SCSI.  In practice, since
> they're so rare, the code paths are never tested (as you found out) and
> there's a more annoying problem which is since the linux base sector
> size is 512, you have to multiply to get from 256 to 512 ... for all
> other sector sizes you have to divide, so any conversion routine that
> only right shifts would get this wrong.
>
>   

from the fdisk man page:

       -b sectorsize   Specify  the  sector  size  of the disk. Valid
values are 512, 1024, 2048 or 4096.  (Recent kernels know the sector
size. Use this only on old kernels or to override the kernel's ideas.)

So how does one create a linux fs on a 256 byte sectored disk?

>>  When it sees a 768 byte sector disk,
>> it says it's an unsupported size and goes on with the boot process
>> without even doing a read for a partition table.
>>     
> that's because 768 isn't a power of 2, so it's completely unsupportable.
>
>   
>>  Should maybe it be
>> doing the same for a 256 byte sector disk???
>>     
> Possibly ... I don't know what the 256 byte sector support was for ...
> all I know is that whatever it was, I don't have one.
>
>   

Back in the old days, almost any scsi disk could be formatted with a 256
byte sector. At one time it probably made since to support it. But try
to find one that supports that sector size today.

In any case, if you can't even partition a 256 byte sector scsi disk in
linux, why would the kernel still claim it supports that format?

Regards
Mark
Comment 10 Mark Hounschell 2010-05-31 11:28:08 UTC
On 05/30/2010 07:51 AM, Mark Hounschell wrote:
> On 05/28/2010 04:25 PM, James Bottomley wrote:
>   
>> On Fri, 2010-05-28 at 15:29 -0400, Mark Hounschell wrote:
>>   
>>     
>>> On 05/28/2010 12:34 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
>>>     
>>>       
>>>> https://bugzilla.kernel.org/show_bug.cgi?id=16058
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --- Comment #6 from Anonymous Emailer <anonymous@kernel-bugs.osdl.org> 
>>>> 2010-05-28 16:34:28 ---
>>>> Reply-To: James.Bottomley@suse.de
>>>>
>>>> On Fri, 2010-05-28 at 10:58 -0400, Alan Stern wrote:
>>>>   
>>>>       
>>>>         
>>>>> On Fri, 28 May 2010, Mark Hounschell wrote:
>>>>>
>>>>>     
>>>>>         
>>>>>           
>>>>>> First READ(10):
>>>>>>
>>>>>>  sde:
>>>>>> ahc_calc_residual: Entered
>>>>>> ahc_calc_residual: return Case 5-1 resid = 0x800
>>>>>> ahc_calc_residual: return Case 5-2 resid = 0x800
>>>>>>
>>>>>> scsi_finish_command: Entered for cmd(10):0x28 0x00 0x00 0x00 0x00 0x00
>>>>>> 0x00 0x00 0x08 0x00
>>>>>> cmd->result = 0x00000000
>>>>>> good_bytes == old_good_bytes = 0x800  scsi_get_resid(cmd) = 0x800
>>>>>> New good_bytes = 0x0
>>>>>> scsi_finish_command: Complete
>>>>>>
>>>>>> From here it just keeps repeating this read of 8 blocks. (2048 bytes) so
>>>>>> it looks like the machine is hung.
>>>>>>       
>>>>>>           
>>>>>>             
>>>>> Probably not hung, just doing a lot of retries.  It should time out 
>>>>> eventually, but it might take a long time (perhaps as long as 15 
>>>>> minutes).  The combination of the block layer and the SCSI layer isn't 
>>>>> very good at knowing when to give up.
>>>>>     
>>>>>         
>>>>>           
>>>> Actually, I think this is a partition read.  Each partition manager
>>>> tends to read a page through the page cache.  If we get an error, we
>>>> seem to re-read to fill the cache.
>>>>
>>>>   
>>>>       
>>>>         
>>>>>> Now, I know for a fact that _if_ this read CDB is actually being sent to
>>>>>> the drive, it's actual residual count will be zero. These are working
>>>>>> disks and that read CDB is valid.
>>>>>>
>>>>>> Why is ahc_calc_residual saying that the residual count is as though the
>>>>>> read never took place? I noticed that the first read on all the SATA
>>>>>> drives was for 4096 bytes, why is this one only 2048? Should it have
>>>>>> been 4096 and ahc_calc_residual assume that?
>>>>>>       
>>>>>>           
>>>>>>             
>>>>> I don't know the answer to any of these questions.  They could well be
>>>>> due to bugs in the driver, and I know nothing about how the aic7xxx
>>>>> driver works.  You should talk to someone who does.
>>>>>     
>>>>>         
>>>>>           
>>>> I'll take this one ... although we're a bit lacking in documentation for
>>>> this driver.
>>>>
>>>> I think the 2048 is because something is hardcoded to think 8 sectors is
>>>> a page.
>>>>
>>>> James
>>>>
>>>>   
>>>>       
>>>>         
>>> Your probably right. But is a 256 byte sector really a supported sector
>>> size for a linux fs on a SCSI disk?
>>>     
>>>       
>> In theory the block layer can support any power of two sector size (or
>> really any sector size which is a divisor of the page size).  We had a
>> use for 256 byte sectors once, so they're in SCSI.  In practice, since
>> they're so rare, the code paths are never tested (as you found out) and
>> there's a more annoying problem which is since the linux base sector
>> size is 512, you have to multiply to get from 256 to 512 ... for all
>> other sector sizes you have to divide, so any conversion routine that
>> only right shifts would get this wrong.
>>
>>   
>>     
> from the fdisk man page:
>
>        -b sectorsize   Specify  the  sector  size  of the disk. Valid
> values are 512, 1024, 2048 or 4096.  (Recent kernels know the sector
> size. Use this only on old kernels or to override the kernel's ideas.)
>
> So how does one create a linux fs on a 256 byte sectored disk?
>
>   
>>>  When it sees a 768 byte sector disk,
>>> it says it's an unsupported size and goes on with the boot process
>>> without even doing a read for a partition table.
>>>     
>>>       
>> that's because 768 isn't a power of 2, so it's completely unsupportable.
>>
>>   
>>     
>>>  Should maybe it be
>>> doing the same for a 256 byte sector disk???
>>>     
>>>       
>> Possibly ... I don't know what the 256 byte sector support was for ...
>> all I know is that whatever it was, I don't have one.
>>
>>   
>>     
> Back in the old days, almost any scsi disk could be formatted with a 256
> byte sector. At one time it probably made since to support it. But try
> to find one that supports that sector size today.
>
> In any case, if you can't even partition a 256 byte sector scsi disk in
> linux, why would the kernel still claim it supports that format?
>
>   

In fact, the attached patch works for me. However, if you wish to pursue
functional 256 byte sector support, I have plenty of these disks and
will be happy to test what ever you come up with. Not a lot I can really
do without fdisk support though. Even so, I'm all ears???

Regards
Mark
Comment 11 Anonymous Emailer 2010-05-31 14:03:42 UTC
Reply-To: James.Bottomley@suse.de

On Mon, 2010-05-31 at 07:25 -0400, Mark Hounschell wrote:
> On 05/30/2010 07:51 AM, Mark Hounschell wrote:
> > On 05/28/2010 04:25 PM, James Bottomley wrote:
> >   
> >> On Fri, 2010-05-28 at 15:29 -0400, Mark Hounschell wrote:
> >>   
> >>     
> >>> On 05/28/2010 12:34 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> >>>     
> >>>       
> >>>> https://bugzilla.kernel.org/show_bug.cgi?id=16058
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> --- Comment #6 from Anonymous Emailer <anonymous@kernel-bugs.osdl.org> 
> 2010-05-28 16:34:28 ---
> >>>> Reply-To: James.Bottomley@suse.de
> >>>>
> >>>> On Fri, 2010-05-28 at 10:58 -0400, Alan Stern wrote:
> >>>>   
> >>>>       
> >>>>         
> >>>>> On Fri, 28 May 2010, Mark Hounschell wrote:
> >>>>>
> >>>>>     
> >>>>>         
> >>>>>           
> >>>>>> First READ(10):
> >>>>>>
> >>>>>>  sde:
> >>>>>> ahc_calc_residual: Entered
> >>>>>> ahc_calc_residual: return Case 5-1 resid = 0x800
> >>>>>> ahc_calc_residual: return Case 5-2 resid = 0x800
> >>>>>>
> >>>>>> scsi_finish_command: Entered for cmd(10):0x28 0x00 0x00 0x00 0x00 0x00
> >>>>>> 0x00 0x00 0x08 0x00
> >>>>>> cmd->result = 0x00000000
> >>>>>> good_bytes == old_good_bytes = 0x800  scsi_get_resid(cmd) = 0x800
> >>>>>> New good_bytes = 0x0
> >>>>>> scsi_finish_command: Complete
> >>>>>>
> >>>>>> From here it just keeps repeating this read of 8 blocks. (2048 bytes)
> so
> >>>>>> it looks like the machine is hung.
> >>>>>>       
> >>>>>>           
> >>>>>>             
> >>>>> Probably not hung, just doing a lot of retries.  It should time out 
> >>>>> eventually, but it might take a long time (perhaps as long as 15 
> >>>>> minutes).  The combination of the block layer and the SCSI layer isn't 
> >>>>> very good at knowing when to give up.
> >>>>>     
> >>>>>         
> >>>>>           
> >>>> Actually, I think this is a partition read.  Each partition manager
> >>>> tends to read a page through the page cache.  If we get an error, we
> >>>> seem to re-read to fill the cache.
> >>>>
> >>>>   
> >>>>       
> >>>>         
> >>>>>> Now, I know for a fact that _if_ this read CDB is actually being sent
> to
> >>>>>> the drive, it's actual residual count will be zero. These are working
> >>>>>> disks and that read CDB is valid.
> >>>>>>
> >>>>>> Why is ahc_calc_residual saying that the residual count is as though
> the
> >>>>>> read never took place? I noticed that the first read on all the SATA
> >>>>>> drives was for 4096 bytes, why is this one only 2048? Should it have
> >>>>>> been 4096 and ahc_calc_residual assume that?
> >>>>>>       
> >>>>>>           
> >>>>>>             
> >>>>> I don't know the answer to any of these questions.  They could well be
> >>>>> due to bugs in the driver, and I know nothing about how the aic7xxx
> >>>>> driver works.  You should talk to someone who does.
> >>>>>     
> >>>>>         
> >>>>>           
> >>>> I'll take this one ... although we're a bit lacking in documentation for
> >>>> this driver.
> >>>>
> >>>> I think the 2048 is because something is hardcoded to think 8 sectors is
> >>>> a page.
> >>>>
> >>>> James
> >>>>
> >>>>   
> >>>>       
> >>>>         
> >>> Your probably right. But is a 256 byte sector really a supported sector
> >>> size for a linux fs on a SCSI disk?
> >>>     
> >>>       
> >> In theory the block layer can support any power of two sector size (or
> >> really any sector size which is a divisor of the page size).  We had a
> >> use for 256 byte sectors once, so they're in SCSI.  In practice, since
> >> they're so rare, the code paths are never tested (as you found out) and
> >> there's a more annoying problem which is since the linux base sector
> >> size is 512, you have to multiply to get from 256 to 512 ... for all
> >> other sector sizes you have to divide, so any conversion routine that
> >> only right shifts would get this wrong.
> >>
> >>   
> >>     
> > from the fdisk man page:
> >
> >        -b sectorsize   Specify  the  sector  size  of the disk. Valid
> > values are 512, 1024, 2048 or 4096.  (Recent kernels know the sector
> > size. Use this only on old kernels or to override the kernel's ideas.)
> >
> > So how does one create a linux fs on a 256 byte sectored disk?
> >
> >   
> >>>  When it sees a 768 byte sector disk,
> >>> it says it's an unsupported size and goes on with the boot process
> >>> without even doing a read for a partition table.
> >>>     
> >>>       
> >> that's because 768 isn't a power of 2, so it's completely unsupportable.
> >>
> >>   
> >>     
> >>>  Should maybe it be
> >>> doing the same for a 256 byte sector disk???
> >>>     
> >>>       
> >> Possibly ... I don't know what the 256 byte sector support was for ...
> >> all I know is that whatever it was, I don't have one.
> >>
> >>   
> >>     
> > Back in the old days, almost any scsi disk could be formatted with a 256
> > byte sector. At one time it probably made since to support it. But try
> > to find one that supports that sector size today.
> >
> > In any case, if you can't even partition a 256 byte sector scsi disk in
> > linux, why would the kernel still claim it supports that format?
> >
> >   
> 
> In fact, the attached patch works for me. However, if you wish to pursue
> functional 256 byte sector support, I have plenty of these disks and
> will be happy to test what ever you come up with.

Um, well, since you've got a lot of them that does rather argue against
their being obsolete ...

>  Not a lot I can really
> do without fdisk support though. Even so, I'm all ears???

fdisk is only the dos label ... there's a lot you can't do with a dos
label.  I think parted will allow you to write a label that will work.

I've got scsi_debug patched to work with 256 byte sectors.  It actually
looks like this has nothing to do with the residue.  What I see is a
hang because block is trying to do a zero sized read.  I suspect
something is trying to do a single sector read, which is impossible
since the linux native sector size is 512 and it's getting rounded down.

This might, of course, argue that block cannot now support 256 sector
devices and so they need to be deprecated ... I'll see.

James
Comment 12 Mark Hounschell 2010-05-31 15:18:37 UTC
On 05/31/2010 10:02 AM, James Bottomley wrote:
> On Mon, 2010-05-31 at 07:25 -0400, Mark Hounschell wrote:
>   
>> On 05/30/2010 07:51 AM, Mark Hounschell wrote:
>>     
>>> On 05/28/2010 04:25 PM, James Bottomley wrote:
>>>   
>>>       
>>>> On Fri, 2010-05-28 at 15:29 -0400, Mark Hounschell wrote:
>>>>   
>>>>     
>>>>         
>>>>> On 05/28/2010 12:34 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
>>>>>     
>>>>>       
>>>>>           
>>>>>> https://bugzilla.kernel.org/show_bug.cgi?id=16058
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --- Comment #6 from Anonymous Emailer <anonymous@kernel-bugs.osdl.org> 
>>>>>> 2010-05-28 16:34:28 ---
>>>>>> Reply-To: James.Bottomley@suse.de
>>>>>>
>>>>>> On Fri, 2010-05-28 at 10:58 -0400, Alan Stern wrote:
>>>>>>   
>>>>>>       
>>>>>>         
>>>>>>             
>>>>>>> On Fri, 28 May 2010, Mark Hounschell wrote:
>>>>>>>
>>>>>>>     
>>>>>>>         
>>>>>>>           
>>>>>>>               
>>>>>>>> First READ(10):
>>>>>>>>
>>>>>>>>  sde:
>>>>>>>> ahc_calc_residual: Entered
>>>>>>>> ahc_calc_residual: return Case 5-1 resid = 0x800
>>>>>>>> ahc_calc_residual: return Case 5-2 resid = 0x800
>>>>>>>>
>>>>>>>> scsi_finish_command: Entered for cmd(10):0x28 0x00 0x00 0x00 0x00 0x00
>>>>>>>> 0x00 0x00 0x08 0x00
>>>>>>>> cmd->result = 0x00000000
>>>>>>>> good_bytes == old_good_bytes = 0x800  scsi_get_resid(cmd) = 0x800
>>>>>>>> New good_bytes = 0x0
>>>>>>>> scsi_finish_command: Complete
>>>>>>>>
>>>>>>>> From here it just keeps repeating this read of 8 blocks. (2048 bytes)
>>>>>>>> so
>>>>>>>> it looks like the machine is hung.
>>>>>>>>       
>>>>>>>>           
>>>>>>>>             
>>>>>>>>                 
>>>>>>> Probably not hung, just doing a lot of retries.  It should time out 
>>>>>>> eventually, but it might take a long time (perhaps as long as 15 
>>>>>>> minutes).  The combination of the block layer and the SCSI layer isn't 
>>>>>>> very good at knowing when to give up.
>>>>>>>     
>>>>>>>         
>>>>>>>           
>>>>>>>               
>>>>>> Actually, I think this is a partition read.  Each partition manager
>>>>>> tends to read a page through the page cache.  If we get an error, we
>>>>>> seem to re-read to fill the cache.
>>>>>>
>>>>>>   
>>>>>>       
>>>>>>         
>>>>>>             
>>>>>>>> Now, I know for a fact that _if_ this read CDB is actually being sent
>>>>>>>> to
>>>>>>>> the drive, it's actual residual count will be zero. These are working
>>>>>>>> disks and that read CDB is valid.
>>>>>>>>
>>>>>>>> Why is ahc_calc_residual saying that the residual count is as though
>>>>>>>> the
>>>>>>>> read never took place? I noticed that the first read on all the SATA
>>>>>>>> drives was for 4096 bytes, why is this one only 2048? Should it have
>>>>>>>> been 4096 and ahc_calc_residual assume that?
>>>>>>>>       
>>>>>>>>           
>>>>>>>>             
>>>>>>>>                 
>>>>>>> I don't know the answer to any of these questions.  They could well be
>>>>>>> due to bugs in the driver, and I know nothing about how the aic7xxx
>>>>>>> driver works.  You should talk to someone who does.
>>>>>>>     
>>>>>>>         
>>>>>>>           
>>>>>>>               
>>>>>> I'll take this one ... although we're a bit lacking in documentation for
>>>>>> this driver.
>>>>>>
>>>>>> I think the 2048 is because something is hardcoded to think 8 sectors is
>>>>>> a page.
>>>>>>
>>>>>> James
>>>>>>
>>>>>>   
>>>>>>       
>>>>>>         
>>>>>>             
>>>>> Your probably right. But is a 256 byte sector really a supported sector
>>>>> size for a linux fs on a SCSI disk?
>>>>>     
>>>>>       
>>>>>           
>>>> In theory the block layer can support any power of two sector size (or
>>>> really any sector size which is a divisor of the page size).  We had a
>>>> use for 256 byte sectors once, so they're in SCSI.  In practice, since
>>>> they're so rare, the code paths are never tested (as you found out) and
>>>> there's a more annoying problem which is since the linux base sector
>>>> size is 512, you have to multiply to get from 256 to 512 ... for all
>>>> other sector sizes you have to divide, so any conversion routine that
>>>> only right shifts would get this wrong.
>>>>
>>>>   
>>>>     
>>>>         
>>> from the fdisk man page:
>>>
>>>        -b sectorsize   Specify  the  sector  size  of the disk. Valid
>>> values are 512, 1024, 2048 or 4096.  (Recent kernels know the sector
>>> size. Use this only on old kernels or to override the kernel's ideas.)
>>>
>>> So how does one create a linux fs on a 256 byte sectored disk?
>>>
>>>   
>>>       
>>>>>  When it sees a 768 byte sector disk,
>>>>> it says it's an unsupported size and goes on with the boot process
>>>>> without even doing a read for a partition table.
>>>>>     
>>>>>       
>>>>>           
>>>> that's because 768 isn't a power of 2, so it's completely unsupportable.
>>>>
>>>>   
>>>>     
>>>>         
>>>>>  Should maybe it be
>>>>> doing the same for a 256 byte sector disk???
>>>>>     
>>>>>       
>>>>>           
>>>> Possibly ... I don't know what the 256 byte sector support was for ...
>>>> all I know is that whatever it was, I don't have one.
>>>>
>>>>   
>>>>     
>>>>         
>>> Back in the old days, almost any scsi disk could be formatted with a 256
>>> byte sector. At one time it probably made since to support it. But try
>>> to find one that supports that sector size today.
>>>
>>> In any case, if you can't even partition a 256 byte sector scsi disk in
>>> linux, why would the kernel still claim it supports that format?
>>>
>>>   
>>>       
>> In fact, the attached patch works for me. However, if you wish to pursue
>> functional 256 byte sector support, I have plenty of these disks and
>> will be happy to test what ever you come up with.
>>     
> Um, well, since you've got a lot of them that does rather argue against
> their being obsolete ...
>
>   

Except I would  _never_  attempt to use any of them for an actual Linux
fs. If I did, and again I wouldn't, it would be after formatting them
with a 512 byte sector.  Way too slow and small. We only provide support
for them in an emulation of an old RTOS called MPX-32 using the sg_io
interface.

>>  Not a lot I can really
>> do without fdisk support though. Even so, I'm all ears???
>>     
> fdisk is only the dos label ... there's a lot you can't do with a dos
> label.  I think parted will allow you to write a label that will work.
>
> I've got scsi_debug patched to work with 256 byte sectors.  It actually
> looks like this has nothing to do with the residue.  What I see is a
> hang because block is trying to do a zero sized read.  I suspect
> something is trying to do a single sector read, which is impossible
> since the linux native sector size is 512 and it's getting rounded down.
>
> This might, of course, argue that block cannot now support 256 sector
> devices and so they need to be deprecated ... I'll see.
>
> James
>
>
>
>
Comment 13 Mark Hounschell 2010-06-17 11:06:21 UTC
On 05/31/2010 11:17 AM, Mark Hounschell wrote:
> On 05/31/2010 10:02 AM, James Bottomley wrote:
>   
>> On Mon, 2010-05-31 at 07:25 -0400, Mark Hounschell wrote:
>>   
>>     
>>> On 05/30/2010 07:51 AM, Mark Hounschell wrote:
>>>     
>>>       
>>>> On 05/28/2010 04:25 PM, James Bottomley wrote:
>>>>   
>>>>       
>>>>         
>>>>> On Fri, 2010-05-28 at 15:29 -0400, Mark Hounschell wrote:
>>>>>   
>>>>>     
>>>>>         
>>>>>           
>>>>>> On 05/28/2010 12:34 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
>>>>>>     
>>>>>>       
>>>>>>           
>>>>>>             
>>>>>>> https://bugzilla.kernel.org/show_bug.cgi?id=16058
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --- Comment #6 from Anonymous Emailer <anonymous@kernel-bugs.osdl.org> 
>>>>>>> 2010-05-28 16:34:28 ---
>>>>>>> Reply-To: James.Bottomley@suse.de
>>>>>>>
>>>>>>> On Fri, 2010-05-28 at 10:58 -0400, Alan Stern wrote:
>>>>>>>   
>>>>>>>       
>>>>>>>         
>>>>>>>             
>>>>>>>               
>>>>>>>> On Fri, 28 May 2010, Mark Hounschell wrote:
>>>>>>>>
>>>>>>>>     
>>>>>>>>         
>>>>>>>>           
>>>>>>>>               
>>>>>>>>                 
>>>>>>>>> First READ(10):
>>>>>>>>>
>>>>>>>>>  sde:
>>>>>>>>> ahc_calc_residual: Entered
>>>>>>>>> ahc_calc_residual: return Case 5-1 resid = 0x800
>>>>>>>>> ahc_calc_residual: return Case 5-2 resid = 0x800
>>>>>>>>>
>>>>>>>>> scsi_finish_command: Entered for cmd(10):0x28 0x00 0x00 0x00 0x00
>>>>>>>>> 0x00
>>>>>>>>> 0x00 0x00 0x08 0x00
>>>>>>>>> cmd->result = 0x00000000
>>>>>>>>> good_bytes == old_good_bytes = 0x800  scsi_get_resid(cmd) = 0x800
>>>>>>>>> New good_bytes = 0x0
>>>>>>>>> scsi_finish_command: Complete
>>>>>>>>>
>>>>>>>>> From here it just keeps repeating this read of 8 blocks. (2048 bytes)
>>>>>>>>> so
>>>>>>>>> it looks like the machine is hung.
>>>>>>>>>       
>>>>>>>>>           
>>>>>>>>>             
>>>>>>>>>                 
>>>>>>>>>                   
>>>>>>>> Probably not hung, just doing a lot of retries.  It should time out 
>>>>>>>> eventually, but it might take a long time (perhaps as long as 15 
>>>>>>>> minutes).  The combination of the block layer and the SCSI layer isn't 
>>>>>>>> very good at knowing when to give up.
>>>>>>>>     
>>>>>>>>         
>>>>>>>>           
>>>>>>>>               
>>>>>>>>                 
>>>>>>> Actually, I think this is a partition read.  Each partition manager
>>>>>>> tends to read a page through the page cache.  If we get an error, we
>>>>>>> seem to re-read to fill the cache.
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>         
>>>>>>>             
>>>>>>>               
>>>>>>>>> Now, I know for a fact that _if_ this read CDB is actually being sent
>>>>>>>>> to
>>>>>>>>> the drive, it's actual residual count will be zero. These are working
>>>>>>>>> disks and that read CDB is valid.
>>>>>>>>>
>>>>>>>>> Why is ahc_calc_residual saying that the residual count is as though
>>>>>>>>> the
>>>>>>>>> read never took place? I noticed that the first read on all the SATA
>>>>>>>>> drives was for 4096 bytes, why is this one only 2048? Should it have
>>>>>>>>> been 4096 and ahc_calc_residual assume that?
>>>>>>>>>       
>>>>>>>>>           
>>>>>>>>>             
>>>>>>>>>                 
>>>>>>>>>                   
>>>>>>>> I don't know the answer to any of these questions.  They could well be
>>>>>>>> due to bugs in the driver, and I know nothing about how the aic7xxx
>>>>>>>> driver works.  You should talk to someone who does.
>>>>>>>>     
>>>>>>>>         
>>>>>>>>           
>>>>>>>>               
>>>>>>>>                 
>>>>>>> I'll take this one ... although we're a bit lacking in documentation
>>>>>>> for
>>>>>>> this driver.
>>>>>>>
>>>>>>> I think the 2048 is because something is hardcoded to think 8 sectors
>>>>>>> is
>>>>>>> a page.
>>>>>>>
>>>>>>> James
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>         
>>>>>>>             
>>>>>>>               
>>>>>> Your probably right. But is a 256 byte sector really a supported sector
>>>>>> size for a linux fs on a SCSI disk?
>>>>>>     
>>>>>>       
>>>>>>           
>>>>>>             
>>>>> In theory the block layer can support any power of two sector size (or
>>>>> really any sector size which is a divisor of the page size).  We had a
>>>>> use for 256 byte sectors once, so they're in SCSI.  In practice, since
>>>>> they're so rare, the code paths are never tested (as you found out) and
>>>>> there's a more annoying problem which is since the linux base sector
>>>>> size is 512, you have to multiply to get from 256 to 512 ... for all
>>>>> other sector sizes you have to divide, so any conversion routine that
>>>>> only right shifts would get this wrong.
>>>>>
>>>>>   
>>>>>     
>>>>>         
>>>>>           
>>>> from the fdisk man page:
>>>>
>>>>        -b sectorsize   Specify  the  sector  size  of the disk. Valid
>>>> values are 512, 1024, 2048 or 4096.  (Recent kernels know the sector
>>>> size. Use this only on old kernels or to override the kernel's ideas.)
>>>>
>>>> So how does one create a linux fs on a 256 byte sectored disk?
>>>>
>>>>   
>>>>       
>>>>         
>>>>>>  When it sees a 768 byte sector disk,
>>>>>> it says it's an unsupported size and goes on with the boot process
>>>>>> without even doing a read for a partition table.
>>>>>>     
>>>>>>       
>>>>>>           
>>>>>>             
>>>>> that's because 768 isn't a power of 2, so it's completely unsupportable.
>>>>>
>>>>>   
>>>>>     
>>>>>         
>>>>>           
>>>>>>  Should maybe it be
>>>>>> doing the same for a 256 byte sector disk???
>>>>>>     
>>>>>>       
>>>>>>           
>>>>>>             
>>>>> Possibly ... I don't know what the 256 byte sector support was for ...
>>>>> all I know is that whatever it was, I don't have one.
>>>>>
>>>>>   
>>>>>     
>>>>>         
>>>>>           
>>>> Back in the old days, almost any scsi disk could be formatted with a 256
>>>> byte sector. At one time it probably made since to support it. But try
>>>> to find one that supports that sector size today.
>>>>
>>>> In any case, if you can't even partition a 256 byte sector scsi disk in
>>>> linux, why would the kernel still claim it supports that format?
>>>>
>>>>   
>>>>       
>>>>         
>>> In fact, the attached patch works for me. However, if you wish to pursue
>>> functional 256 byte sector support, I have plenty of these disks and
>>> will be happy to test what ever you come up with.
>>>     
>>>       
>> Um, well, since you've got a lot of them that does rather argue against
>> their being obsolete ...
>>
>>   
>>     
> Except I would  _never_  attempt to use any of them for an actual Linux
> fs. If I did, and again I wouldn't, it would be after formatting them
> with a 512 byte sector.  Way too slow and small. We only provide support
> for them in an emulation of an old RTOS called MPX-32 using the sg_io
> interface.
>
>   
>>>  Not a lot I can really
>>> do without fdisk support though. Even so, I'm all ears???
>>>     
>>>       
>> fdisk is only the dos label ... there's a lot you can't do with a dos
>> label.  I think parted will allow you to write a label that will work.
>>
>> I've got scsi_debug patched to work with 256 byte sectors.  It actually
>> looks like this has nothing to do with the residue.  What I see is a
>> hang because block is trying to do a zero sized read.  I suspect
>> something is trying to do a single sector read, which is impossible
>> since the linux native sector size is 512 and it's getting rounded down.
>>
>> This might, of course, argue that block cannot now support 256 sector
>> devices and so they need to be deprecated ... I'll see.
>>
>> James
>>     

I know your a busy guy,  I was just wondering if this BUG is still being
given consideration? 

Thanks
Mark
Comment 14 Anonymous Emailer 2010-06-17 13:36:44 UTC
Reply-To: James.Bottomley@suse.de

On Thu, 2010-06-17 at 07:04 -0400, Mark Hounschell wrote: 
> On 05/31/2010 11:17 AM, Mark Hounschell wrote:
> > On 05/31/2010 10:02 AM, James Bottomley wrote:
> >   
> >> On Mon, 2010-05-31 at 07:25 -0400, Mark Hounschell wrote:
> >>   
> >>     
> >>> On 05/30/2010 07:51 AM, Mark Hounschell wrote:
> >>>     
> >>>       
> >>>> On 05/28/2010 04:25 PM, James Bottomley wrote:
> >>>>   
> >>>>       
> >>>>         
> >>>>> On Fri, 2010-05-28 at 15:29 -0400, Mark Hounschell wrote:
> >>>>>   
> >>>>>     
> >>>>>         
> >>>>>           
> >>>>>> On 05/28/2010 12:34 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> >>>>>>     
> >>>>>>       
> >>>>>>           
> >>>>>>             
> >>>>>>> https://bugzilla.kernel.org/show_bug.cgi?id=16058
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> --- Comment #6 from Anonymous Emailer
> <anonymous@kernel-bugs.osdl.org>  2010-05-28 16:34:28 ---
> >>>>>>> Reply-To: James.Bottomley@suse.de
> >>>>>>>
> >>>>>>> On Fri, 2010-05-28 at 10:58 -0400, Alan Stern wrote:
> >>>>>>>   
> >>>>>>>       
> >>>>>>>         
> >>>>>>>             
> >>>>>>>               
> >>>>>>>> On Fri, 28 May 2010, Mark Hounschell wrote:
> >>>>>>>>
> >>>>>>>>     
> >>>>>>>>         
> >>>>>>>>           
> >>>>>>>>               
> >>>>>>>>                 
> >>>>>>>>> First READ(10):
> >>>>>>>>>
> >>>>>>>>>  sde:
> >>>>>>>>> ahc_calc_residual: Entered
> >>>>>>>>> ahc_calc_residual: return Case 5-1 resid = 0x800
> >>>>>>>>> ahc_calc_residual: return Case 5-2 resid = 0x800
> >>>>>>>>>
> >>>>>>>>> scsi_finish_command: Entered for cmd(10):0x28 0x00 0x00 0x00 0x00
> 0x00
> >>>>>>>>> 0x00 0x00 0x08 0x00
> >>>>>>>>> cmd->result = 0x00000000
> >>>>>>>>> good_bytes == old_good_bytes = 0x800  scsi_get_resid(cmd) = 0x800
> >>>>>>>>> New good_bytes = 0x0
> >>>>>>>>> scsi_finish_command: Complete
> >>>>>>>>>
> >>>>>>>>> From here it just keeps repeating this read of 8 blocks. (2048
> bytes) so
> >>>>>>>>> it looks like the machine is hung.
> >>>>>>>>>       
> >>>>>>>>>           
> >>>>>>>>>             
> >>>>>>>>>                 
> >>>>>>>>>                   
> >>>>>>>> Probably not hung, just doing a lot of retries.  It should time out 
> >>>>>>>> eventually, but it might take a long time (perhaps as long as 15 
> >>>>>>>> minutes).  The combination of the block layer and the SCSI layer
> isn't 
> >>>>>>>> very good at knowing when to give up.
> >>>>>>>>     
> >>>>>>>>         
> >>>>>>>>           
> >>>>>>>>               
> >>>>>>>>                 
> >>>>>>> Actually, I think this is a partition read.  Each partition manager
> >>>>>>> tends to read a page through the page cache.  If we get an error, we
> >>>>>>> seem to re-read to fill the cache.
> >>>>>>>
> >>>>>>>   
> >>>>>>>       
> >>>>>>>         
> >>>>>>>             
> >>>>>>>               
> >>>>>>>>> Now, I know for a fact that _if_ this read CDB is actually being
> sent to
> >>>>>>>>> the drive, it's actual residual count will be zero. These are
> working
> >>>>>>>>> disks and that read CDB is valid.
> >>>>>>>>>
> >>>>>>>>> Why is ahc_calc_residual saying that the residual count is as
> though the
> >>>>>>>>> read never took place? I noticed that the first read on all the
> SATA
> >>>>>>>>> drives was for 4096 bytes, why is this one only 2048? Should it
> have
> >>>>>>>>> been 4096 and ahc_calc_residual assume that?
> >>>>>>>>>       
> >>>>>>>>>           
> >>>>>>>>>             
> >>>>>>>>>                 
> >>>>>>>>>                   
> >>>>>>>> I don't know the answer to any of these questions.  They could well
> be
> >>>>>>>> due to bugs in the driver, and I know nothing about how the aic7xxx
> >>>>>>>> driver works.  You should talk to someone who does.
> >>>>>>>>     
> >>>>>>>>         
> >>>>>>>>           
> >>>>>>>>               
> >>>>>>>>                 
> >>>>>>> I'll take this one ... although we're a bit lacking in documentation
> for
> >>>>>>> this driver.
> >>>>>>>
> >>>>>>> I think the 2048 is because something is hardcoded to think 8 sectors
> is
> >>>>>>> a page.
> >>>>>>>
> >>>>>>> James
> >>>>>>>
> >>>>>>>   
> >>>>>>>       
> >>>>>>>         
> >>>>>>>             
> >>>>>>>               
> >>>>>> Your probably right. But is a 256 byte sector really a supported
> sector
> >>>>>> size for a linux fs on a SCSI disk?
> >>>>>>     
> >>>>>>       
> >>>>>>           
> >>>>>>             
> >>>>> In theory the block layer can support any power of two sector size (or
> >>>>> really any sector size which is a divisor of the page size).  We had a
> >>>>> use for 256 byte sectors once, so they're in SCSI.  In practice, since
> >>>>> they're so rare, the code paths are never tested (as you found out) and
> >>>>> there's a more annoying problem which is since the linux base sector
> >>>>> size is 512, you have to multiply to get from 256 to 512 ... for all
> >>>>> other sector sizes you have to divide, so any conversion routine that
> >>>>> only right shifts would get this wrong.
> >>>>>
> >>>>>   
> >>>>>     
> >>>>>         
> >>>>>           
> >>>> from the fdisk man page:
> >>>>
> >>>>        -b sectorsize   Specify  the  sector  size  of the disk. Valid
> >>>> values are 512, 1024, 2048 or 4096.  (Recent kernels know the sector
> >>>> size. Use this only on old kernels or to override the kernel's ideas.)
> >>>>
> >>>> So how does one create a linux fs on a 256 byte sectored disk?
> >>>>
> >>>>   
> >>>>       
> >>>>         
> >>>>>>  When it sees a 768 byte sector disk,
> >>>>>> it says it's an unsupported size and goes on with the boot process
> >>>>>> without even doing a read for a partition table.
> >>>>>>     
> >>>>>>       
> >>>>>>           
> >>>>>>             
> >>>>> that's because 768 isn't a power of 2, so it's completely
> unsupportable.
> >>>>>
> >>>>>   
> >>>>>     
> >>>>>         
> >>>>>           
> >>>>>>  Should maybe it be
> >>>>>> doing the same for a 256 byte sector disk???
> >>>>>>     
> >>>>>>       
> >>>>>>           
> >>>>>>             
> >>>>> Possibly ... I don't know what the 256 byte sector support was for ...
> >>>>> all I know is that whatever it was, I don't have one.
> >>>>>
> >>>>>   
> >>>>>     
> >>>>>         
> >>>>>           
> >>>> Back in the old days, almost any scsi disk could be formatted with a 256
> >>>> byte sector. At one time it probably made since to support it. But try
> >>>> to find one that supports that sector size today.
> >>>>
> >>>> In any case, if you can't even partition a 256 byte sector scsi disk in
> >>>> linux, why would the kernel still claim it supports that format?
> >>>>
> >>>>   
> >>>>       
> >>>>         
> >>> In fact, the attached patch works for me. However, if you wish to pursue
> >>> functional 256 byte sector support, I have plenty of these disks and
> >>> will be happy to test what ever you come up with.
> >>>     
> >>>       
> >> Um, well, since you've got a lot of them that does rather argue against
> >> their being obsolete ...
> >>
> >>   
> >>     
> > Except I would  _never_  attempt to use any of them for an actual Linux
> > fs. If I did, and again I wouldn't, it would be after formatting them
> > with a 512 byte sector.  Way too slow and small. We only provide support
> > for them in an emulation of an old RTOS called MPX-32 using the sg_io
> > interface.
> >
> >   
> >>>  Not a lot I can really
> >>> do without fdisk support though. Even so, I'm all ears???
> >>>     
> >>>       
> >> fdisk is only the dos label ... there's a lot you can't do with a dos
> >> label.  I think parted will allow you to write a label that will work.
> >>
> >> I've got scsi_debug patched to work with 256 byte sectors.  It actually
> >> looks like this has nothing to do with the residue.  What I see is a
> >> hang because block is trying to do a zero sized read.  I suspect
> >> something is trying to do a single sector read, which is impossible
> >> since the linux native sector size is 512 and it's getting rounded down.
> >>
> >> This might, of course, argue that block cannot now support 256 sector
> >> devices and so they need to be deprecated ... I'll see.
> >>
> >> James
> >>     
> 
> I know your a busy guy,  I was just wondering if this BUG is still being
> given consideration? 

Yes, but it got lost in the merge window.  I was investigating where the
break is ... since the whole of block has allowances for 256 byte sector
devices, it seems that something once used it.

James
Comment 15 xerofoify 2014-06-24 17:13:43 UTC
This bug is against obsolete kernel. Please try with
newer kernel to see if it's fixed.
Cheers Nick
Comment 16 Mark Hounschell 2015-05-12 13:24:40 UTC
This bug is still valid. A 256 byte sector disk will cause kernel-4.0.2 to hang.
Every since this bug was reported I have rolled my own patch that causes 256 byte sector disk to be unsupported for a linux fs. I use these disks in raw mode using sg3 API only. No one would ever use these disks for a linux fs. I would be happy to submit this patch. 

Mark
Comment 17 Alan 2015-05-12 13:29:20 UTC
It would be good to get this fixed so if you have a patch it would be good to get it upstream. The only users I know of 256 byte/sector are a few ancient USB devices and also retro-computing folk . For the retro stuff the file systems are not native Linux anyway so requiring sg wouldn't be a problem.
Comment 18 Mark Hounschell 2015-05-12 13:44:28 UTC
Created attachment 176501 [details]
make scsi disk 256 byte sector unsupported for linux filesystems

This patch makes 256 byte sector disks unsupported for linux fs. Since kernel 2.6.x or so I have been unable to boot with a 256 byte sector installed.
Comment 19 Mark Hounschell 2015-05-12 13:46:12 UTC
Feel free to add my signed off by:

Signed-off-by: Mark Hounschell <dmarkh@cfl.rr.com>

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