Bug 433481 - sg: cap reserved_size values to max_sectors
sg: cap reserved_size values to max_sectors
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel (Show other bugs)
5.1
All Linux
urgent Severity high
: rc
: ---
Assigned To: David Milburn
Martin Jenner
: Regression
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-02-19 10:54 EST by Bryn M. Reeves
Modified: 2010-10-22 18:37 EDT (History)
2 users (show)

See Also:
Fixed In Version: RHBA-2008-0314
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-05-21 11:09:44 EDT
Type: ---
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 Bryn M. Reeves 2008-02-19 10:54:46 EST
Description of problem:
The sg driver does not cap the reserved_size values at max_sectors for the
SG_GET_RESERVED_SIZE and SG_SET_RESERVED_SIZE sg ioctls. This prevents tools
like cdrecord and sg_dd from obtaining a legal value for the maximum transfer
length and causing problems such as failed burns and I/O errors.

See kernel bugzill #7026: http://bugzilla.kernel.org/show_bug.cgi?id=7026

Version-Release number of selected component (if applicable):
2.6.18-53.el5, 2.6.18-81.el5

How reproducible:
100%

Steps to Reproduce:
With sg_dd:
1. sg_dd if=/dev/sg1 of=/dev/null bpt=128 bs=2048 count=128

Using cdrecord you can hit the same underlying problem (see steps in kbz#7026).
  
Actual results:
# sg_dd if=/dev/sg1 of=/dev/null bpt=128 bs=2048 count=128
reading: SCSI status: Check Condition
Descriptor format, current;  Sense key: Aborted Command
Additional sense: No additional sense information
 Descriptor type: Information
   0x0000000000000000
plus...: Driver_status=0x08 [DRIVER_SENSE, SUGGEST_OK]
sg_read failed, at or after lba=0 [0x0]
Some error occurred,  remaining block count=128
0+0 records in
0+0 records out
1 unrecovered read error(s)

Expected results:
sg_dd exits with success.

Additional info:
Fixed upstream:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=44ec95425c1d9dce6e4638c29e4362cfb44814e7
Comment 1 Bryn M. Reeves 2008-02-19 10:55:57 EST
commit 44ec95425c1d9dce6e4638c29e4362cfb44814e7
Author: Alan Stern <stern@rowland.harvard.edu>
Date:   Tue Feb 20 11:01:57 2007 -0500

[SCSI] sg: cap reserved_size values at max_sectors
Alan Stern [Tue, 20 Feb 2007 16:01:57 +0000 (11:01 -0500)]
This patch (as857) modifies the SG_GET_RESERVED_SIZE and
SG_SET_RESERVED_SIZE ioctls in the sg driver, capping the values at
the device's request_queue's max_sectors value.  This will permit
cdrecord to obtain a legal value for the maximum transfer length,
fixing Bugzilla #7026.

The patch also caps the initial reserved_size value.  There's no
reason to have a reserved buffer larger than max_sectors, since it
would be impossible to use the extra space.

The corresponding ioctls in the block layer are modified similarly,
and the initial value for the reserved_size is set as large as
possible.  This will effectively make it default to max_sectors.
Note that the actual value is meaningless anyway, since block devices
don't have a reserved buffer.

Finally, the BLKSECTGET ioctl is added to sg, so that there will be a
uniform way for users to determine the actual max_sectors value for
any raw SCSI transport.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Comment 4 RHEL Product and Program Management 2008-02-29 10:48:51 EST
This bugzilla has Keywords: Regression.  

Since no regressions are allowed between releases, 
it is also being proposed as a blocker for this release.  

Please resolve ASAP.
Comment 7 RHEL Product and Program Management 2008-03-19 10:26:02 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 10 RHEL Product and Program Management 2008-03-20 07:55:46 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 12 Don Zickus 2008-03-26 16:31:45 EDT
in kernel-2.6.18-87.el5
You can download this test kernel from http://people.redhat.com/dzickus/el5
Comment 16 errata-xmlrpc 2008-05-21 11:09:44 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2008-0314.html

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