diff options
author | Joe Eykholt <jeykholt@cisco.com> | 2010-03-12 19:08:55 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-04-11 10:23:44 -0400 |
commit | f018b73af6db4f330ad5da9ac53997a699c30c42 (patch) | |
tree | 4f4e9405d923c0021771549dbdec34569c0e27a7 /include/scsi | |
parent | b3ef990c1514859bffae221b9e82e46a38f1e7bf (diff) |
[SCSI] libfc, libfcoe, fcoe: use smp_processor_id() only when preempt disabled
When the kernel is configured for preemption, using smp_processor_id()
when preemption is enabled causes a warning backtrace and is wrong
since we could move off of that CPU as soon as we get the ID,
and we would be referencing the wrong CPU, and possibly an invalid one
if it could be hotswapped out.
Remove the fc_lport_get_stats() function and explicitly use per_cpu_ptr()
to get the statistics. Where preemption has been disabled by holding
a _bh lock continue to use smp_processor_id(), but otherwise use
get_cpu()/put_cpu().
In fcoe_recv_frame() also changed the cases where we return in the
middle to do a goto to the code which bumps ErrorFrames and does
a put_cpu(). Two of these cases didn't bump ErrorFrames before, but
doing so is harmless because they "can't happen", due to prior length
checks.
Also rearranged code in fcoe_recv_frame() to have only one call to
fc_exch_recv(). It's just as efficient and saves a call to put_cpu().
In fc_fcp.c, adjusted a FIXME comment for code which doesn't need fixing.
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/libfc.h | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index 4b912eee33e5..8d0d1b2d8258 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h | |||
@@ -918,15 +918,6 @@ static inline void fc_lport_free_stats(struct fc_lport *lport) | |||
918 | } | 918 | } |
919 | 919 | ||
920 | /** | 920 | /** |
921 | * fc_lport_get_stats() - Get a local port's statistics | ||
922 | * @lport: The local port whose statistics are to be retreived | ||
923 | */ | ||
924 | static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lport) | ||
925 | { | ||
926 | return per_cpu_ptr(lport->dev_stats, smp_processor_id()); | ||
927 | } | ||
928 | |||
929 | /** | ||
930 | * lport_priv() - Return the private data from a local port | 921 | * lport_priv() - Return the private data from a local port |
931 | * @lport: The local port whose private data is to be retreived | 922 | * @lport: The local port whose private data is to be retreived |
932 | */ | 923 | */ |