aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2009-02-20 08:53:48 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-03-05 11:34:37 -0500
commit33dd6f92a1a7ad85c54d47fd9d73371a32c0bde4 (patch)
tree8390e0a43bac01b4e393d9ec35b8a58823e98da4
parent559595a985e106d2fa9f0c79b7f5805453fed593 (diff)
[SCSI] sd: Don't try to spin up drives that are connected to an inactive port
We currently try to spin up drives connected to standby and unavailable ports. This will never succeed and wastes a lot of time. Fail quickly if the sense data reports the port is in standby or unavailable state. Reported-by: Narayanan Rengarajan <narayanan.rengarajan@hp.com> Tested-by: Narayanan Rengarajan <narayanan.rengarajan@hp.com> Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--drivers/scsi/sd.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 55310dbc10a6..4970ae4a62d6 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1167,23 +1167,19 @@ sd_spinup_disk(struct scsi_disk *sdkp)
1167 /* 1167 /*
1168 * The device does not want the automatic start to be issued. 1168 * The device does not want the automatic start to be issued.
1169 */ 1169 */
1170 if (sdkp->device->no_start_on_add) { 1170 if (sdkp->device->no_start_on_add)
1171 break; 1171 break;
1172 }
1173
1174 /*
1175 * If manual intervention is required, or this is an
1176 * absent USB storage device, a spinup is meaningless.
1177 */
1178 if (sense_valid &&
1179 sshdr.sense_key == NOT_READY &&
1180 sshdr.asc == 4 && sshdr.ascq == 3) {
1181 break; /* manual intervention required */
1182 1172
1183 /* 1173 if (sense_valid && sshdr.sense_key == NOT_READY) {
1184 * Issue command to spin up drive when not ready 1174 if (sshdr.asc == 4 && sshdr.ascq == 3)
1185 */ 1175 break; /* manual intervention required */
1186 } else if (sense_valid && sshdr.sense_key == NOT_READY) { 1176 if (sshdr.asc == 4 && sshdr.ascq == 0xb)
1177 break; /* standby */
1178 if (sshdr.asc == 4 && sshdr.ascq == 0xc)
1179 break; /* unavailable */
1180 /*
1181 * Issue command to spin up drive when not ready
1182 */
1187 if (!spintime) { 1183 if (!spintime) {
1188 sd_printk(KERN_NOTICE, sdkp, "Spinning up disk..."); 1184 sd_printk(KERN_NOTICE, sdkp, "Spinning up disk...");
1189 cmd[0] = START_STOP; 1185 cmd[0] = START_STOP;
n559' href='#n559'>559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888























































































































































































































































































































































































































































































































































































































































































































































































































































































































                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
‹