diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-27 13:08:58 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-27 13:08:58 -0400 |
| commit | 18c2152d526e7956457fcdcbdf6d77ae2c663a26 (patch) | |
| tree | f936cf832425bc008e348fbe2491447a683b238a | |
| parent | 4a3c390c384f31c60aaf0502dcd3d790a9ebebca (diff) | |
| parent | 602432c150251f20fb4a41a5a6463b91e3d19053 (diff) | |
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley:
"Two small fixes: one is a fatal section mismatch (reference to init
after it's discarded) and the other two are iscsi locking fixes"
* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: NCR5380: no longer mark irq probing as __init
scsi: be2iscsi: Replace _bh with _irqsave/irqrestore
scsi: libiscsi: Fix locking in __iscsi_conn_send_pdu
| -rw-r--r-- | drivers/scsi/NCR5380.c | 6 | ||||
| -rw-r--r-- | drivers/scsi/be2iscsi/be_main.c | 37 | ||||
| -rw-r--r-- | drivers/scsi/libiscsi.c | 4 |
3 files changed, 28 insertions, 19 deletions
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index db2739079cbb..790babc5ef66 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c | |||
| @@ -353,7 +353,7 @@ static void NCR5380_print_phase(struct Scsi_Host *instance) | |||
| 353 | #endif | 353 | #endif |
| 354 | 354 | ||
| 355 | 355 | ||
| 356 | static int probe_irq __initdata; | 356 | static int probe_irq; |
| 357 | 357 | ||
| 358 | /** | 358 | /** |
| 359 | * probe_intr - helper for IRQ autoprobe | 359 | * probe_intr - helper for IRQ autoprobe |
| @@ -365,7 +365,7 @@ static int probe_irq __initdata; | |||
| 365 | * used by the IRQ probe code. | 365 | * used by the IRQ probe code. |
| 366 | */ | 366 | */ |
| 367 | 367 | ||
| 368 | static irqreturn_t __init probe_intr(int irq, void *dev_id) | 368 | static irqreturn_t probe_intr(int irq, void *dev_id) |
| 369 | { | 369 | { |
| 370 | probe_irq = irq; | 370 | probe_irq = irq; |
| 371 | return IRQ_HANDLED; | 371 | return IRQ_HANDLED; |
| @@ -380,7 +380,7 @@ static irqreturn_t __init probe_intr(int irq, void *dev_id) | |||
| 380 | * and then looking to see what interrupt actually turned up. | 380 | * and then looking to see what interrupt actually turned up. |
| 381 | */ | 381 | */ |
| 382 | 382 | ||
| 383 | static int __init __maybe_unused NCR5380_probe_irq(struct Scsi_Host *instance, | 383 | static int __maybe_unused NCR5380_probe_irq(struct Scsi_Host *instance, |
| 384 | int possible) | 384 | int possible) |
| 385 | { | 385 | { |
| 386 | struct NCR5380_hostdata *hostdata = shost_priv(instance); | 386 | struct NCR5380_hostdata *hostdata = shost_priv(instance); |
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 68138a647dfc..d9239c2d49b1 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c | |||
| @@ -900,8 +900,9 @@ void hwi_ring_cq_db(struct beiscsi_hba *phba, | |||
| 900 | static struct sgl_handle *alloc_io_sgl_handle(struct beiscsi_hba *phba) | 900 | static struct sgl_handle *alloc_io_sgl_handle(struct beiscsi_hba *phba) |
| 901 | { | 901 | { |
| 902 | struct sgl_handle *psgl_handle; | 902 | struct sgl_handle *psgl_handle; |
| 903 | unsigned long flags; | ||
| 903 | 904 | ||
| 904 | spin_lock_bh(&phba->io_sgl_lock); | 905 | spin_lock_irqsave(&phba->io_sgl_lock, flags); |
| 905 | if (phba->io_sgl_hndl_avbl) { | 906 | if (phba->io_sgl_hndl_avbl) { |
| 906 | beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_IO, | 907 | beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_IO, |
| 907 | "BM_%d : In alloc_io_sgl_handle," | 908 | "BM_%d : In alloc_io_sgl_handle," |
| @@ -919,14 +920,16 @@ static struct sgl_handle *alloc_io_sgl_handle(struct beiscsi_hba *phba) | |||
| 919 | phba->io_sgl_alloc_index++; | 920 | phba->io_sgl_alloc_index++; |
| 920 | } else | 921 | } else |
| 921 | psgl_handle = NULL; | 922 | psgl_handle = NULL; |
| 922 | spin_unlock_bh(&phba->io_sgl_lock); | 923 | spin_unlock_irqrestore(&phba->io_sgl_lock, flags); |
| 923 | return psgl_handle; | 924 | return psgl_handle; |
| 924 | } | 925 | } |
| 925 | 926 | ||
| 926 | static void | 927 | static void |
| 927 | free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle) | 928 | free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle) |
| 928 | { | 929 | { |
| 929 | spin_lock_bh(&phba->io_sgl_lock); | 930 | unsigned long flags; |
| 931 | |||
| 932 | spin_lock_irqsave(&phba->io_sgl_lock, flags); | ||
| 930 | beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_IO, | 933 | beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_IO, |
| 931 | "BM_%d : In free_,io_sgl_free_index=%d\n", | 934 | "BM_%d : In free_,io_sgl_free_index=%d\n", |
| 932 | phba->io_sgl_free_index); | 935 | phba->io_sgl_free_index); |
| @@ -941,7 +944,7 @@ free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle) | |||
| 941 | "value there=%p\n", phba->io_sgl_free_index, | 944 | "value there=%p\n", phba->io_sgl_free_index, |
| 942 | phba->io_sgl_hndl_base | 945 | phba->io_sgl_hndl_base |
| 943 | [phba->io_sgl_free_index]); | 946 | [phba->io_sgl_free_index]); |
| 944 | spin_unlock_bh(&phba->io_sgl_lock); | 947 | spin_unlock_irqrestore(&phba->io_sgl_lock, flags); |
| 945 | return; | 948 | return; |
| 946 | } | 949 | } |
| 947 | phba->io_sgl_hndl_base[phba->io_sgl_free_index] = psgl_handle; | 950 | phba->io_sgl_hndl_base[phba->io_sgl_free_index] = psgl_handle; |
| @@ -950,7 +953,7 @@ free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle) | |||
| 950 | phba->io_sgl_free_index = 0; | 953 | phba->io_sgl_free_index = 0; |
| 951 | else | 954 | else |
| 952 | phba->io_sgl_free_index++; | 955 | phba->io_sgl_free_index++; |
| 953 | spin_unlock_bh(&phba->io_sgl_lock); | 956 | spin_unlock_irqrestore(&phba->io_sgl_lock, flags); |
| 954 | } | 957 | } |
| 955 | 958 | ||
| 956 | static inline struct wrb_handle * | 959 | static inline struct wrb_handle * |
| @@ -958,15 +961,16 @@ beiscsi_get_wrb_handle(struct hwi_wrb_context *pwrb_context, | |||
| 958 | unsigned int wrbs_per_cxn) | 961 | unsigned int wrbs_per_cxn) |
| 959 | { | 962 | { |
| 960 | struct wrb_handle *pwrb_handle; | 963 | struct wrb_handle *pwrb_handle; |
| 964 | unsigned long flags; | ||
| 961 | 965 | ||
| 962 | spin_lock_bh(&pwrb_context->wrb_lock); | 966 | spin_lock_irqsave(&pwrb_context->wrb_lock, flags); |
| 963 | pwrb_handle = pwrb_context->pwrb_handle_base[pwrb_context->alloc_index]; | 967 | pwrb_handle = pwrb_context->pwrb_handle_base[pwrb_context->alloc_index]; |
| 964 | pwrb_context->wrb_handles_available--; | 968 | pwrb_context->wrb_handles_available--; |
| 965 | if (pwrb_context->alloc_index == (wrbs_per_cxn - 1)) | 969 | if (pwrb_context->alloc_index == (wrbs_per_cxn - 1)) |
| 966 | pwrb_context->alloc_index = 0; | 970 | pwrb_context->alloc_index = 0; |
| 967 | else | 971 | else |
| 968 | pwrb_context->alloc_index++; | 972 | pwrb_context->alloc_index++; |
| 969 | spin_unlock_bh(&pwrb_context->wrb_lock); | 973 | spin_unlock_irqrestore(&pwrb_context->wrb_lock, flags); |
| 970 | 974 | ||
| 971 | if (pwrb_handle) | 975 | if (pwrb_handle) |
| 972 | memset(pwrb_handle->pwrb, 0, sizeof(*pwrb_handle->pwrb)); | 976 | memset(pwrb_handle->pwrb, 0, sizeof(*pwrb_handle->pwrb)); |
| @@ -1001,14 +1005,16 @@ beiscsi_put_wrb_handle(struct hwi_wrb_context *pwrb_context, | |||
| 1001 | struct wrb_handle *pwrb_handle, | 1005 | struct wrb_handle *pwrb_handle, |
| 1002 | unsigned int wrbs_per_cxn) | 1006 | unsigned int wrbs_per_cxn) |
| 1003 | { | 1007 | { |
| 1004 | spin_lock_bh(&pwrb_context->wrb_lock); | 1008 | unsigned long flags; |
| 1009 | |||
| 1010 | spin_lock_irqsave(&pwrb_context->wrb_lock, flags); | ||
| 1005 | pwrb_context->pwrb_handle_base[pwrb_context->free_index] = pwrb_handle; | 1011 | pwrb_context->pwrb_handle_base[pwrb_context->free_index] = pwrb_handle; |
| 1006 | pwrb_context->wrb_handles_available++; | 1012 | pwrb_context->wrb_handles_available++; |
| 1007 | if (pwrb_context->free_index == (wrbs_per_cxn - 1)) | 1013 | if (pwrb_context->free_index == (wrbs_per_cxn - 1)) |
| 1008 | pwrb_context->free_index = 0; | 1014 | pwrb_context->free_index = 0; |
| 1009 | else | 1015 | else |
| 1010 | pwrb_context->free_index++; | 1016 | pwrb_context->free_index++; |
| 1011 | spin_unlock_bh(&pwrb_context->wrb_lock); | 1017 | spin_unlock_irqrestore(&pwrb_context->wrb_lock, flags); |
| 1012 | } | 1018 | } |
| 1013 | 1019 | ||
| 1014 | /** | 1020 | /** |
| @@ -1037,8 +1043,9 @@ free_wrb_handle(struct beiscsi_hba *phba, struct hwi_wrb_context *pwrb_context, | |||
| 1037 | static struct sgl_handle *alloc_mgmt_sgl_handle(struct beiscsi_hba *phba) | 1043 | static struct sgl_handle *alloc_mgmt_sgl_handle(struct beiscsi_hba *phba) |
| 1038 | { | 1044 | { |
| 1039 | struct sgl_handle *psgl_handle; | 1045 | struct sgl_handle *psgl_handle; |
| 1046 | unsigned long flags; | ||
| 1040 | 1047 | ||
| 1041 | spin_lock_bh(&phba->mgmt_sgl_lock); | 1048 | spin_lock_irqsave(&phba->mgmt_sgl_lock, flags); |
| 1042 | if (phba->eh_sgl_hndl_avbl) { | 1049 | if (phba->eh_sgl_hndl_avbl) { |
| 1043 | psgl_handle = phba->eh_sgl_hndl_base[phba->eh_sgl_alloc_index]; | 1050 | psgl_handle = phba->eh_sgl_hndl_base[phba->eh_sgl_alloc_index]; |
| 1044 | phba->eh_sgl_hndl_base[phba->eh_sgl_alloc_index] = NULL; | 1051 | phba->eh_sgl_hndl_base[phba->eh_sgl_alloc_index] = NULL; |
| @@ -1056,14 +1063,16 @@ static struct sgl_handle *alloc_mgmt_sgl_handle(struct beiscsi_hba *phba) | |||
| 1056 | phba->eh_sgl_alloc_index++; | 1063 | phba->eh_sgl_alloc_index++; |
| 1057 | } else | 1064 | } else |
| 1058 | psgl_handle = NULL; | 1065 | psgl_handle = NULL; |
| 1059 | spin_unlock_bh(&phba->mgmt_sgl_lock); | 1066 | spin_unlock_irqrestore(&phba->mgmt_sgl_lock, flags); |
| 1060 | return psgl_handle; | 1067 | return psgl_handle; |
| 1061 | } | 1068 | } |
| 1062 | 1069 | ||
| 1063 | void | 1070 | void |
| 1064 | free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle) | 1071 | free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle) |
| 1065 | { | 1072 | { |
| 1066 | spin_lock_bh(&phba->mgmt_sgl_lock); | 1073 | unsigned long flags; |
| 1074 | |||
| 1075 | spin_lock_irqsave(&phba->mgmt_sgl_lock, flags); | ||
| 1067 | beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG, | 1076 | beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG, |
| 1068 | "BM_%d : In free_mgmt_sgl_handle," | 1077 | "BM_%d : In free_mgmt_sgl_handle," |
| 1069 | "eh_sgl_free_index=%d\n", | 1078 | "eh_sgl_free_index=%d\n", |
| @@ -1078,7 +1087,7 @@ free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle) | |||
| 1078 | "BM_%d : Double Free in eh SGL ," | 1087 | "BM_%d : Double Free in eh SGL ," |
| 1079 | "eh_sgl_free_index=%d\n", | 1088 | "eh_sgl_free_index=%d\n", |
| 1080 | phba->eh_sgl_free_index); | 1089 | phba->eh_sgl_free_index); |
| 1081 | spin_unlock_bh(&phba->mgmt_sgl_lock); | 1090 | spin_unlock_irqrestore(&phba->mgmt_sgl_lock, flags); |
| 1082 | return; | ||
