diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 10:19:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 10:19:18 -0400 |
commit | 33cf23b0a535475aead57707cb9f4fe135a93544 (patch) | |
tree | 67e14f77f0eeab847a26a6cbfcb44eecb5fa2fda /drivers/scsi/sd.c | |
parent | 7a9b149212f3716c598afe973b6261fd58453b7a (diff) | |
parent | 95bb335c0ebe96afe926387a1ef3a096bd884a82 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (182 commits)
[SCSI] aacraid: add an ifdef'd device delete case instead of taking the device offline
[SCSI] aacraid: prohibit access to array container space
[SCSI] aacraid: add support for handling ATA pass-through commands.
[SCSI] aacraid: expose physical devices for models with newer firmware
[SCSI] aacraid: respond automatically to volumes added by config tool
[SCSI] fcoe: fix fcoe module ref counting
[SCSI] libfcoe: FIP Keep-Alive messages for VPorts are sent with incorrect port_id and wwn
[SCSI] libfcoe: Fix incorrect MAC address clearing
[SCSI] fcoe: fix a circular locking issue with rtnl and sysfs mutex
[SCSI] libfc: Move the port_id into lport
[SCSI] fcoe: move link speed checking into its own routine
[SCSI] libfc: Remove extra pointer check
[SCSI] libfc: Remove unused fc_get_host_port_type
[SCSI] fcoe: fixes wrong error exit in fcoe_create
[SCSI] libfc: set seq_id for incoming sequence
[SCSI] qla2xxx: Updates to ISP82xx support.
[SCSI] qla2xxx: Optionally disable target reset.
[SCSI] qla2xxx: ensure flash operation and host reset via sg_reset are mutually exclusive
[SCSI] qla2xxx: Silence bogus warning by gcc for wrap and did.
[SCSI] qla2xxx: T10 DIF support added.
...
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r-- | drivers/scsi/sd.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index de6c60320f6f..829cc37abc41 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -1434,6 +1434,8 @@ static void read_capacity_error(struct scsi_disk *sdkp, struct scsi_device *sdp, | |||
1434 | #error RC16_LEN must not be more than SD_BUF_SIZE | 1434 | #error RC16_LEN must not be more than SD_BUF_SIZE |
1435 | #endif | 1435 | #endif |
1436 | 1436 | ||
1437 | #define READ_CAPACITY_RETRIES_ON_RESET 10 | ||
1438 | |||
1437 | static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, | 1439 | static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, |
1438 | unsigned char *buffer) | 1440 | unsigned char *buffer) |
1439 | { | 1441 | { |
@@ -1441,7 +1443,7 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, | |||
1441 | struct scsi_sense_hdr sshdr; | 1443 | struct scsi_sense_hdr sshdr; |
1442 | int sense_valid = 0; | 1444 | int sense_valid = 0; |
1443 | int the_result; | 1445 | int the_result; |
1444 | int retries = 3; | 1446 | int retries = 3, reset_retries = READ_CAPACITY_RETRIES_ON_RESET; |
1445 | unsigned int alignment; | 1447 | unsigned int alignment; |
1446 | unsigned long long lba; | 1448 | unsigned long long lba; |
1447 | unsigned sector_size; | 1449 | unsigned sector_size; |
@@ -1470,6 +1472,13 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, | |||
1470 | * Invalid Field in CDB, just retry | 1472 | * Invalid Field in CDB, just retry |
1471 | * silently with RC10 */ | 1473 | * silently with RC10 */ |
1472 | return -EINVAL; | 1474 | return -EINVAL; |
1475 | if (sense_valid && | ||
1476 | sshdr.sense_key == UNIT_ATTENTION && | ||
1477 | sshdr.asc == 0x29 && sshdr.ascq == 0x00) | ||
1478 | /* Device reset might occur several times, | ||
1479 | * give it one more chance */ | ||
1480 | if (--reset_retries > 0) | ||
1481 | continue; | ||
1473 | } | 1482 | } |
1474 | retries--; | 1483 | retries--; |
1475 | 1484 | ||
@@ -1528,7 +1537,7 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, | |||
1528 | struct scsi_sense_hdr sshdr; | 1537 | struct scsi_sense_hdr sshdr; |
1529 | int sense_valid = 0; | 1538 | int sense_valid = 0; |
1530 | int the_result; | 1539 | int the_result; |
1531 | int retries = 3; | 1540 | int retries = 3, reset_retries = READ_CAPACITY_RETRIES_ON_RESET; |
1532 | sector_t lba; | 1541 | sector_t lba; |
1533 | unsigned sector_size; | 1542 | unsigned sector_size; |
1534 | 1543 | ||
@@ -1544,8 +1553,16 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, | |||
1544 | if (media_not_present(sdkp, &sshdr)) | 1553 | if (media_not_present(sdkp, &sshdr)) |
1545 | return -ENODEV; | 1554 | return -ENODEV; |
1546 | 1555 | ||
1547 | if (the_result) | 1556 | if (the_result) { |
1548 | sense_valid = scsi_sense_valid(&sshdr); | 1557 | sense_valid = scsi_sense_valid(&sshdr); |
1558 | if (sense_valid && | ||
1559 | sshdr.sense_key == UNIT_ATTENTION && | ||
1560 | sshdr.asc == 0x29 && sshdr.ascq == 0x00) | ||
1561 | /* Device reset might occur several times, | ||
1562 | * give it one more chance */ | ||
1563 | if (--reset_retries > 0) | ||
1564 | continue; | ||
1565 | } | ||
1549 | retries--; | 1566 | retries--; |
1550 | 1567 | ||
1551 | } while (the_result && retries); | 1568 | } while (the_result && retries); |
@@ -1574,6 +1591,8 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, | |||
1574 | 1591 | ||
1575 | static int sd_try_rc16_first(struct scsi_device *sdp) | 1592 | static int sd_try_rc16_first(struct scsi_device *sdp) |
1576 | { | 1593 | { |
1594 | if (sdp->host->max_cmd_len < 16) | ||
1595 | return 0; | ||
1577 | if (sdp->scsi_level > SCSI_SPC_2) | 1596 | if (sdp->scsi_level > SCSI_SPC_2) |
1578 | return 1; | 1597 | return 1; |
1579 | if (scsi_device_protection(sdp)) | 1598 | if (scsi_device_protection(sdp)) |