Red Hat Bugzilla – Bug 433481
sg: cap reserved_size values to max_sectors
Last modified: 2010-10-22 18:37:39 EDT
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):
Steps to Reproduce:
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).
# 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
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)
sg_dd exits with success.
Author: Alan Stern <firstname.lastname@example.org>
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 <email@example.com>
Acked-by: Jens Axboe <firstname.lastname@example.org>
Acked-by: Douglas Gilbert <email@example.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
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.
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
You can download this test kernel from http://people.redhat.com/dzickus/el5
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.